Sign up here and you can log into the forum!

Thumbs for UMSP channels

Discussion, features, plugins--everything about zoster's UMSP UPnP Media Server software

Re: Thumbs for UMSP channels   

Postby vango44 » Tue Apr 05, 2011 11:36 am

Just to clarify, are there supposed to be default thunbnails for the top menu of UMSP? I get all the thumbs when I enter a plugin but no default thumbs.

When I try to add some as explained in this thread, I run into some problems so I'm wondering if this method works with the newest WEC/UMSP selection tab.

My media-items.php doesn't contain all the plugins I've selected from WEC and if I add the items with link to thumbs using the /conf/umsp.php file, it adds another folder(with thumb) but the original plugin folder with no thumb also remains. So I get 2 apple trailer folders and so on.

This is with flashed 0.4.7.3 and PsychoTHC.
vango44
WDTVer
 
Posts: 35
Joined: Sat Apr 10, 2010 10:00 pm
Location: Canada

Re: Thumbs for UMSP channels   

Postby mad_ady » Tue Apr 05, 2011 9:41 pm

First level thumbs for WEC-enabled items also don't show up for me either. I haven't had time to look into it, but I will try to disable /conf/umsp.php to see if it loads thumbs for WEC items this way.
User avatar
mad_ady
Developer
 
Posts: 4573
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: Thumbs for UMSP channels   

Postby shunte » Wed Apr 06, 2011 2:39 am

i fixed the problem with the later and just need to get it into SVN, fixed it back in November 2010 so is taking a while sad to say
also fixed the double mount of Revision3

until then 2 files to replace or mount over - your choice

/usr/share/umsp/funcs-config.php
Code: Select all
<?php

function _configMainHTML($prmPluginInfo, $prmStatus = '') {
    $html  = '<html xmlns="http://www.w3.org/1999/xhtml">';
    $html .= '<head>';
    $html .= '<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />';
    $html .= '<title>' . $prmPluginInfo['name'] . '</title>';
    $html .= '</head>';
    $html .= '<body>';
    $html .= '<p align="center"><strong>' . $prmPluginInfo['name'] . '</strong><br>';
    $html .= $prmPluginInfo['desc'] . '</p>';
    $html .= '<table border="0" align="center" cellspacing="10">';
    $html .= '  <tr>';
    $html .= '    <td>Version: ' . $prmPluginInfo['version'] . '</td>';
    $html .= '    <td>Date: ' . $prmPluginInfo['date'] . '</td>';
    $html .= '  </tr>';
    $html .= '  <tr>';
    $html .= '    <td>Author: ' . $prmPluginInfo['author'] . '</td>';
    $html .= '    <td>ID: ' . $prmPluginInfo['id'] . '</td>';
    $html .= '  </tr>';
    $html .= '  <tr>';
    $html .= '     <td colspan="2" align="center"><a href="' . $prmPluginInfo['url'] . '">Web Link</a></td>';
    $html .= '</table>';
    $html .= '<form method="get">';
    $html .= '<p align="center">';
    $html .= '<input type="radio" name="pluginStatus" value="on"' . ( ($prmStatus == 'on') ? ' checked ' : '' ) . '> Enabled';
    $html .= '<input type="radio" name="pluginStatus" value="off"' . ( ($prmStatus == 'off') ? ' checked ' : '' ) . '> Disabled<br>';
    $html .= '<!--<input type="submit" name="buttonSubmit" id="buttonSubmit" value="Submit" />-->';
    $html .= '<input type="submit" value="Submit" />';
    $html .= '</p>';
    $html .= '</form>';
    $html .= '<hr />';
    return $html;
} # end function

function _createPluginRootItems() {
    $pluginStatusAll = _readPluginStatusAll();
    if ( is_array($pluginStatusAll) ) {
        $pluginRootItems = array();
        foreach ( $pluginStatusAll as $pluginId => $pluginStatus) {
            $pluginConfigFile = (is_file('/tmp/umsp-plugins/' . $pluginId . '/info.php')?'/tmp/umsp-plugins/' . $pluginId . '/info.php':'/tmp/umsp-plugins/' . $pluginId . '/config.php');
            if ( ($pluginStatus =='on') && (is_file($pluginConfigFile)) ) {
                unset($pluginInfo);
                if(strpos($pluginConfigFile,'config.php')!==false)define('_DONT_RUN_CONFIG_',1);
                include($pluginConfigFile);
                if ( is_array($pluginInfo) ) {
                    $pluginRootItems[] = array(   
                        'id'         => 'umsp://plugins/' . $pluginInfo['id'],
                        'parentID'      => '0',
                        'dc:title'      => $pluginInfo['name'],
                        'desc'         => $pluginInfo['desc'],
                        'upnp:class'   => 'object.container',
                        'upnp:album_art'=> $pluginInfo['art'],
                    );
                }
            }
        }
    }
    return $pluginRootItems;
}


function _readPluginStatus($prmPluginId) {
    # TODO: replace with config_tool?
    $status = _readPluginVar($prmPluginId);
    return $status;
} # end function

function _readPluginStatusAll() {
    # TODO: replace with config_tool?
    $pluginStatusAll = _readPluginVarAll();
    if ( is_array($pluginStatusAll) ) {
        return $pluginStatusAll;
    } else {
        return null;
    }
} # end function

function _writePluginStatus($prmPluginId, $prmStatus) {
    # TODO: replace with config_tool?
    # status should be 'on' or 'off'
    $result = _writePluginVar($prmPluginId, $prmStatus);
    return $result;
} # end function

#######################################################################
# TODO: replace with config_tool?
# TODO: remove?

function _readPluginVar($prmVarName) {
        $filename = '/conf/umsp-plugins-status';
        if (!is_readable($filename)) { return null; }
        $handle = fopen($filename, 'r');
        $rawContent = fread($handle, 8192);
        fclose($handle);
        $varData = unserialize($rawContent);
        if (is_array($varData) && isset($varData[$prmVarName])) {
                return $varData[$prmVarName];
        } else {
                return null;
        } # end if
} # end function

function _readPluginVarAll() {
        $filename = '/conf/umsp-plugins-status';
        if (!is_readable($filename)) { return null; }
        $handle = fopen($filename, 'r');
        $rawContent = fread($handle, 8192);
        fclose($handle);
        $varData = unserialize($rawContent);
        if ( is_array($varData) ) {
                return $varData;
        } else {
                return null;
        } # end if
} # end function

function _writePluginVar($prmVarName, $prmVarValue) {
    $filename = '/conf/umsp-plugins-status';
    if (is_readable($filename)) {
        $handle = fopen($filename, 'r');
        $rawContent = fread($handle, 8192);
        fclose($handle);
        $prevData = unserialize($rawContent);
        if ($prevData === false || !is_array($prevData)) {
            $newData = array();
        } else {
            $newData = $prevData;
        }
    } else {
        $newData = array();
    }
    $newData[$prmVarName] = $prmVarValue;
    $filenameTmp = '/tmp/umsp-plugins-status';
    $handle = fopen($filenameTmp, 'w');
    $rawContent = serialize($newData);
    $success = fwrite($handle, $rawContent);
    fclose($handle);
    # TODO: Better solution?
    exec('sudo cp ' . $filenameTmp . ' ' . $filename );
    return $success;
} # end function

?>


/usr/share/umsp/media-items.php
Code: Select all
<?php
#   Crucial elements for an item are:
#   dc:title      The title of the item
#   upnp:class      The media class of the item (see below)
#   res            This is the actual location of the file (either remote "http://someserver.com/file.avi" or local "file:///pathOnWDTV/file.avi")
#   protocolInfo   The media protocol. Syntax is very important or the WDTV will just reset. Refer to /docs/wdtv-mediaprotocols.txt
#               The server reply "content-type" seems to be more relevant than any setting here.
#               Setting '*:*:*:*' seems to work in some/most? cases.
#
#   Play around with the other stuff ;)
#
# UPnP classes:
# object.item.audioItem
# object.item.imageItem
# object.item.videoItem
# object.item.playlistItem   not recognized by WDTV?
# object.item.textItem      not recognized by WDTV?
# object.container         WDTLV will send a browse request for this item when you enter it.



# Copy and repeat:
#-----------------------------
if (file_exists("/dev/sr0")) {
   error_log("cdrom exists!!!\n");
   $myMediaItems[] = array(   
      'id'         => 'umsp://plugins/optical-drive',
      'parentID'      => '0',
      'dc:title'      => 'Optical Drive Manager',
      'upnp:class'   => 'object.container',
      'upnp:album_art'=> 'http://lh3.googleusercontent.com/_xJcSFBlLg_Y/TToVUnarwaI/AAAAAAAAAPQ/IXBSeO8T-ZE/s200/opticaldrive.png',
   );
};
#------------------------------
$myMediaItems[] = array(   
   'id'         => 'umsp://plugins/shoutcast',
   'parentID'      => '0',
   'dc:title'      => 'Shoutcast',
   'upnp:class'   => 'object.container',
   'upnp:album_art'=> 'http://lh3.googleusercontent.com/_xJcSFBlLg_Y/TT4KyLI6cCI/AAAAAAAAAQU/PAejQfsyQlQ/s200/shoutcast-badge800x800.png',
);
#------------------------------
$myMediaItems[] = array(   
   'id'         => 'umsp://plugins/bbc',
   'parentID'      => '0',
   'dc:title'      => 'BBC Audio Podcasts (beta!)',
   'upnp:class'   => 'object.container',
   'upnp:album_art'=> 'http://lh3.googleusercontent.com/_xJcSFBlLg_Y/TRSIeDbvcbI/AAAAAAAAAIY/5hBsQUQode0/s200/bbc200x200slate.png',
);

if (file_exists("/conf/umsp.php")) {
   include("/conf/umsp.php");
};

# 'XML UMSP Items Plugin' support
if (file_exists("/tmp/umsp-plugins/umsp-items/umsp-items.func.php") && (file_exists("/conf/umsp-items.xml") || file_exists("/tmp/umsp-plugins/umsp-items/umsp-items.xml"))) {
   require_once "/tmp/umsp-plugins/umsp-items/umsp-items.func.php";
   $myMediaItems = _pluginCreateItems();
};

include_once('/usr/share/umsp/funcs-config.php');
$pluginItems = _createPluginRootItems();
if ( is_array($pluginItems) ) {
   $myMediaItems = array_merge($myMediaItems, $pluginItems);
}

?>


job done...
If you like the work I do please feel free to make a donation to the Red Cross
User avatar
shunte
Developer
 
Posts: 420
Joined: Sun Sep 19, 2010 1:43 am
Location: Cambridge, MA U. S. and A.

Re: Thumbs for UMSP channels   

Postby mad_ady » Wed Apr 06, 2011 3:24 am

Thanks for the patches shunte.

I added them and tested a bit and the icons show up just fine. Beware when copying the files to /conf so you don't fill up the partition. Better use a stick instead. Also, you can add the lines in /conf/S99user-script to be automatically mounted at startup.

Code: Select all
#fix UMSP first level problems
mount -o bind /conf/funcs-config.php /usr/share/umsp/funcs-config.php
mount -o bind /conf/media-items.php /usr/share/umsp/media-items.php
User avatar
mad_ady
Developer
 
Posts: 4573
Joined: Fri Nov 05, 2010 9:08 am
Location: Bucharest, Romania

Re: Thumbs for UMSP channels   

Postby vango44 » Wed Apr 06, 2011 12:50 pm

I added the 2 php files and created the S99user-script to /conf and it all works well now.

Thanks for the quick fix!!

I also deleted some rtorrent files from the conf folder since I was getting close to 50k.
Does it wipe all your settings if you go over or can it actually brick it?
vango44
WDTVer
 
Posts: 35
Joined: Sat Apr 10, 2010 10:00 pm
Location: Canada

Re: Thumbs for UMSP channels   

Postby shunte » Wed Apr 06, 2011 3:33 pm

slowest quick response ever, I did mention I made these changes back in 2010 ;)

hitting size limits doesn't brick the device, just makes things very very unstable

I've had my /conf/config reset to base settings when I apparently hit the limit, I posted my tale of woe on the forum http://forum.wdlxtv.com/viewtopic.php?f=16&t=2701&start=0

I perform backups in my S99 script, not ideal given they're stale but better than starting from scratch

My logic is just to grab copies of the config and the accounts xml file that has login details for YouTube and such; smarter logic would be to copy only if the file was larger than the current copy so if the device did reset you wouldn't overwrite good files

I have an 8GB thumb drive connected permanently and avoid writing anything unnecessary to /conf etc.. good advice from ady there

I also actively manage UMSP and any configuration info that gets written by plug-ins I'll never use. If a plug-in is available and shows up in WEC config attributes will be written even if you don't activate the plug-in

Again I rely on my S99 to dump anything I don't want, and should anything accidentally get written to conf I'll manually edit and then save back to ram disk to ensure I have exactly what I want

my S99user-script is posted here if folks want to pull some of the functions fort their own use
Code: Select all
#!/bin/sh

# cp -f /boot/S99* /conf/

delFile()
{
if [ -f "/usr/share/umsp/plugins/$1" ];
then
logger -t `basename $0` "delFile::/usr/share/umsp/plugins/$1"
rm -f "/usr/share/umsp/plugins/$1";
fi
if [ -f "/usr/share/umsp/available-plugins/$1" ];
then
logger -t `basename $0` "delFile::/usr/share/umsp/available-plugins/$1"
rm -f "/usr/share/umsp/available-plugins/$1";
fi
}

delCon()
{
if [ -d "/usr/share/umsp/plugins/$1" ];
then
logger -t `basename $0` "delCon::/usr/share/umsp/plugins/$1"
rm -fr "/usr/share/umsp/plugins/$1";
fi
}

copCon()
{
#logger -t `basename $0` "copCon:: $0/$1"
if [ -d "/tmp/mnt/$1/$2" ];
then
if [ ! -d "/tmp/umsp-plugins/$2" ];
then
  logger -t `basename $0` "copCon::Make tmp/umsp-plugins/$2"
  mkdir "/tmp/umsp-plugins/$2";
fi
logger -t `basename $0` "copCon::Copy /tmp/mnt/$1/$2/* -> tmp/umsp-plugins/$2"
cp -fR /tmp/mnt/$1/$2/* /tmp/umsp-plugins/$2/;
fi
}

theRoot=`df | grep USB1 | awk '{split($6,p,"/"); print p[6]}' | sed s/\s+//`
if [ ".$theRoot" == '.' ];
then
  theRoot='65b14a17-012e-4387-b6fe-2767b4e8d609'
  logger -t `basename $0` "$theRoot hard set"
fi

logger -t `basename $0` "'$theRoot' is configured"
logger -t `basename $0` "UMSP cleanup"
#cp -f /tmp/mnt/$theRoot/weather_wec.php /tmp/config-plugins
delFile pornhub.php
delFile tube8.php
delFile revision3.php
delFile bliptv.php
delFile comedy-dstl.php
delFile comedy-htf.php
delFile comedy.php
delFile culture-nlhd.php
delFile culture.php
delFile discovery-video.php
delFile games-coop.php
delFile games-g4-trailers.php
delFile games-g4-xplay.php
delFile games-gt.php
delFile games.php
delFile news-dwdd.php
delFile news-ednl.php
delFile news-mbh.php
delFile news-penw.php
delFile news-trosnl.php
delFile news-zdf.php
delFile news.php
delFile tech-engadgethd.php
delFile tech-hdnation.php
delFile tech-hdnation2.php
delFile tech-hubble.php
delFile tech-hwi.php
delFile tech.php
delFile toaster_revision3.php

delCon dreambox-e2
delCon eyetv
delCon freeview
delCon reader
delCon rlslog
delCon umsp-items
delCon umspmaint
#delCon daily-podcasts
delCon vdr
delCon youtube-subscriptions
delCon stagevu
delCon weather
delCon pin-code
delCon exua

logger -t `basename $0` "UMSP copies"
copCon $theRoot kelbytv
copCon $theRoot kelbytutes
copCon $theRoot channel9
copCon $theRoot mythtv
copCon $theRoot wdpbs
copCon $theRoot svtplay
copCon $theRoot gemist
copCon $theRoot wdslim

logger -t `basename $0` "Fix UMSP base scripts"
cp -f /tmp/mnt/$theRoot/media-items.php /usr/share/umsp/media-items.php
cp -f /tmp/mnt/$theRoot/funcs-config.php /usr/share/umsp/funcs-config.php

# WIP
#copCon $theRoot filmtrailer
#copCon $theRoot apple-trailers
# end WIP

logger -t `basename $0` "Simple backups being performed, logic flawed - can do better"
cp /conf/config /tmp/mnt/$theRoot/safeconfig
cp /conf/account_list.xml /tmp/mnt/$theRoot/safeaccount_list.xml


I manually run the S99 if I save anything via WEC just to ensure I'm close to what I'd expect - note that the script is't dynamic so anything new being added to SVN needs to be managed accordingly.

And with that in mind - better application management inclusive of UMSP is in the works so hopefully much of this preemptive strike stuff will be a thing of the past soon
If you like the work I do please feel free to make a donation to the Red Cross
User avatar
shunte
Developer
 
Posts: 420
Joined: Sun Sep 19, 2010 1:43 am
Location: Cambridge, MA U. S. and A.

Previous

Return to UMSP Media Server

Who is online

Users browsing this forum: No registered users and 2 guests

cron