Youtube subscriptions

From WikiDLXTV
Jump to: navigation, search

Description

The Youtube subscriptions plugin allows you to view your Youtube subscription videos the same way the youtube interface shows them to the registered users. The plugin is included in the base usmp plugins. The plugin has two components: proxy+web interface and a helper script that generates a list of new videos from your subscriptions. The helper script can be run periodically to ensure you can access the latest videos.

Later, support for playlists has been added and they work similar to subscriptions.

You can also use the search button to search through the cache file for videos with a specific title. The search is done case insensitive and it is interpreted as a regular expression (characters like +, *, ., [], etc have special meaning).


Prerequisites

  • Your Youtube username and password must be entered in the WDTV Youtube section and saved. You can check this by looking for your credentials in /conf/account_list.xml


Configuration

  • Enable Youtube Subscriptions from the web interface (using WEC), or by adding a suitable entry to your /conf/umsp.php
  • To periodically update for new subscriptions(e.g. every 10 minutes), add this entry to your crontab (crontab -e from ssh/telnet):
*/10   *   *   *   *   /usr/bin/php5-cgi /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions-helper.php --insecure  >/tmp/youtube-subscriptions-helper.txt 2>&1

See http://en.wikipedia.org/wiki/Cron for cron syntax

  • After the update, you should get videos under UMSP->Youtube Subscriptions->Your account
  • If you have YOUTUBE_QUALITY set in your configuration, the videos will have the requested resolution (if available) automatically. If it's not set, you will get 240P quality by default. If a video doesn't have the quality you requested, you will get the closest available quality instead. Valid values are:
    • 240P
    • 360P
    • 480P
    • 720P
    • 1080P
  • If you want more than 30 videos per channel listed, add this to your configuration (or configure it from the web interface):
config_tool -c YOUTUBE_VIDEOS_PER_CHANNEL='50'
  • If you want more than 300 videos in New Subscription Videos, add this to your configuration (or configure it from the web interface):
config_tool -c YOUTUBE_NEW_VIDEOS='500'
  • Subscription videos are sorted by default newest first. You can change this by using YOUTUBE_SUBSCRIPTION_SORT (or configure it from the web interface):
config_tool -c YOUTUBE_SUBSCRIPTION_SORT='random'
  • Playlist videos are not sorted by default. You can change this by using YOUTUBE_PLAYLIST_SORT (or configure it from the web interface):
config_tool -c YOUTUBE_PLAYLIST_SORT='random'
  • If you make changes to your configuration, make sure to save it before rebooting (it is saved automatically on reboot, but can be lost if there is a power outage)
config_tool -s
  • If you want your subscriptions to be updated first thing when your wdtv starts up, add this to your /conf/S99user-script
#!/bin/sh
# update youtube subscriptions - delay with 30s!
(sleep 30; /usr/bin/php5-cgi /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions-helper.php --insecure > /tmp/youtube-subscriptions.txt 2>&1)&


Troubleshooting

  • If you don't see your channels in the UMSP GUI, do the following checks:
    • run /usr/bin/php5-cgi /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions-helper.php --insecure by hand in the command line. Look for error messages and their descriptions
    • check that the file /tmp/youtube-subscriptions.cache exists and has content inside (ids and names of youtube clips)
    • check that cron is running and that your crontab is working fine
# config_tool -c CROND='ON'
config saved val:key => (CROND,ON)
# /etc/init.d/S90crond start   
# ps | grep cron
10624 root      3648 S    crond
10721 root      3712 S    grep cron 
  • if cron runs properly you should see messages like this in /tmp/messages.txt:
Jan  1 05:22:01 Deneb cron.err crond[10624]: USER root pid 18851 cmd /usr/bin/php5-cgi /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions-helper.php --insecure  >/tmp/youtube-subscriptions-helper.txt 2>&1
  • If you need to enable logging, you can change each script and edit the line with $logLevel appropriately:
// set the logging level, one of L_ALL, L_DEBUG, L_INFO, L_WARNING, L_ERROR, L_OFF
global $logLevel;
$logLevel = L_WARNING;

Logging goes to /tmp/umsp-log.txt

  • To enable debugging for the menu, run this command
sed -i 's/$logLevel = L_WARNING;/$logLevel = L_ALL;/' /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions.php
  • To enable debugging in the proxy, run this command
sed -i 's/$logLevel = L_WARNING;/$logLevel = L_ALL;/' /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions-proxy.php
  • To enable debugging in the live search code, run this command
sed -i 's/$logLevel = L_WARNING;/$logLevel = L_ALL;/' /tmp/umsp-plugins/youtube-subscriptions/youtube-subscriptions-live.php
  • The plugin no longer works on firmware versions older than 0.4.7.x because of a bug in a UMSP file. If you are still using an older firmware, it's recommended you upgrade. If for any reason you want to keep using the older version, you can add this fix so that the plugin will work again: add this to your /conf/S99user-script:
#!/bin/sh
cp /usr/share/umsp/funcs-log.php /tmp/funcs-log.php
sed -i '/^$/d' /tmp/funcs-log.php
mount -o bind /tmp/funcs-log.php /usr/share/umsp/funcs-log.php


Youtube login issues

If you have problems logging in with your youtube account, please consider that there were some changes due to Google's integration of Youtube into G+. Try out this procedure (thanks to colinpowell):

The problem: I could not get Youtube Subscriptions to update. The videos already cached played fine, but no subs were updating.

The solution: Linking my Youtube account to a google+ address, then activating that page for use with Third-party tools within the Google+ settings. This gave me a proper user name and I set a new password for it. I then entered that username, including the @pages.googleplus.com, and the new password in to the WDVTV Youtube client.

Hey-presto, it worked. 

Shortcuts

If you want to add shortcut entries under UMSP to take you directly to a specific playlist or subscription, you can add custom entries to /conf/umsp.php folowing the examples here: http://forum.wdlxtv.com/viewtopic.php?f=49&t=713&p=33936#p33645 (you just send in the correct parameters in the "id" string)

Security

  • Currently (version 0.4.5.3/0.4.7.3) there is a problem with the certificates that the built-in package curl has shipped in and it can't verify if the server you are talking to is actually the Youtube authentication server. This check is disabled by using --insecure parameter when running youtube-subscriptions-helper.php. When curl will come with the correct certificates, you can drop --insecure and it will verify the authenticity of the Youtube server. Keep in mind that the authentication process is still encrypted regardless of --insecure.


Developer/Changelog