Friday 13 February 2009

Kodak EasyShare W1020 wireless picture frame, part 2

A drawback of the Kodak EasyShare W1020 when playing content from a UPnP media server is that it will only play files from a single selected directory, rather than that directory and its subdirectories. So, for example, you can't select the top-level directory of your media collection and then have the frame play the content of that and all subdirectories.

To get around this problem I've written a Bash script that runs on the same machine as my uShare server. The script makes a random selection of files from my media collection and creates symbolic links to these files in a single directory within the uShare content hierarchy. The frame is configured to play content from that directory.

Script:


#!/bin/bash

CONF=/root/scripts/pf.conf
TMPFILE=$TMP/pf.tmp
OUTDIR="/home/public/media/Picture Frame"
LINKNUM=0

rm "$OUTDIR"/*
exec 3<$CONF
while read -u 3 FINDROOT NUMFILES EXTN
do
find $FINDROOT -iname "*.$EXTN" > $TMPFILE
FILECOUNT=$(wc -l $TMPFILE)
FILECOUNT=${FILECOUNT/ *}
COUNTER=0
while [ $COUNTER -lt $NUMFILES ]; do
let "COUNTER = COUNTER + 1"
let "LINKNUM = LINKNUM + 1"
let "RANDFILE = RANDOM % FILECOUNT + 1"
TARGET=$(gawk -v r=$RANDFILE 'NR == r { print ; exit}' $TMPFILE)
LINKNAME="000"$LINKNUM
LINKNAME=$OUTDIR"/"${LINKNAME:(-3)}"."$EXTN
ln -s "$TARGET" "$LINKNAME"
done
done
exec 3<&-
pkill -HUP -fx "/usr/local/bin/ushare -D"

exit

The script reads a configuration file set in the CONF variable. Each line in this file specifies a top-level directory from which to begin a recursive search for content, the number random files to select and the file extension to search for.

Example configuration file:
/home/public/media/Pictures     20    jpg
/home/public/media/Videos/AVI 1 avi
Line one in this example instructs the script to select twenty random files with a 'jpg' extension from /home/public/media/Pictures and its subdirectories. Line two instructs the script to select one random file with a 'avi' extension from /home/public/media/Videos/AVI and its subdirectories. Further lines can be added as desired.

The OUTDIR variable in the script sets the destination directory where the symbolic links will be created. The frame is configured to play content from this directory.

I run the script each night using cron. The frame timer is set to power the frame off before the script runs and power the frame back on after the script has completed. When the frame restarts it reads the links created in OUTDIR and begins displaying the content.

Kodak EasyShare W1020 wireless picture frame, part 1

I recently added a Kodak EasyShare W1020 wireless picture frame to my collection of media players. One feature that is not documented in the user guide is that this frame can play pictures and video from a UPnP media server.

Here's a screen shot of the frame after it has discovered the uShare server on my network:



And here's another while browsing some of the content directories on uShare:

Friday 22 August 2008

uShare syslog priority

A standard uShare installation logs its 'business as usual' type messages to syslog with a facility of 'daemon' and a priority of 'notice'. My preference is for these type of messages to be logged with a priority of 'info', reserving priorities of 'notice' and above for logging out of the ordinary events.

Here's a simple patch for uShare 1.1a to fix this behaviour:


--- ushare-1.1a.orig/src/trace.c 2007-12-09 13:03:36.000000000 +0000
+++ ushare-1.1a/src/trace.c 2008-08-22 20:52:04.000000000 +0100
@@ -46,7 +46,7 @@
if (is_daemon)
{
int flags = LOG_DAEMON;
- flags |= level == ULOG_ERROR ? LOG_ERR : LOG_NOTICE;
+ flags |= level == ULOG_ERROR ? LOG_ERR : LOG_INFO;
vsyslog (flags, format, va);
}
else

Saturday 26 April 2008

LibUPnP-1.6.6 released

Version 1.6.6 of libupnp has been released. Here's my simultaneous streaming to multiple devices patch updated for this version:

--- libupnp-1.6.6.old/upnp/src/api/upnpapi.c 2007-11-27 04:56:02.000000000 +0000
+++ libupnp-1.6.6/upnp/src/api/upnpapi.c 2007-12-28 16:12:16.000000000 +0000
@@ -264,6 +264,8 @@
return UPNP_E_INIT_FAILED;
}

+ TPAttrSetMinThreads( &attr, 4 );
+
if( ThreadPoolInit( &gMiniServerThreadPool, &attr ) != UPNP_E_SUCCESS ) {
UpnpSdkInit = 0;
UpnpFinish();

Sunday 3 February 2008

LibUPnP-1.6.5 released

Version 1.6.5 of libupnp has been released. Here's my simultaneous streaming to multiple devices patch updated for this version:

--- libupnp-1.6.5.old/upnp/src/api/upnpapi.c 2007-11-27 04:56:02.000000000 +0000
+++ libupnp-1.6.5/upnp/src/api/upnpapi.c 2007-12-28 16:12:16.000000000 +0000
@@ -264,6 +264,8 @@
return UPNP_E_INIT_FAILED;
}

+ TPAttrSetMinThreads( &attr, 4 );
+
if( ThreadPoolInit( &gMiniServerThreadPool, &attr ) != UPNP_E_SUCCESS ) {
UpnpSdkInit = 0;
UpnpFinish();

Sunday 27 January 2008

Error in uShare 1.1 config file

uShare version 1.1 and above allows four new statements in the configuration file:
  • USHARE_ENABLE_WEB
  • USHARE_ENABLE_TELNET
  • USHARE_ENABLE_DLNA
  • USHARE_ENABLE_XBOX
However the "USHARE_" prefix of each of these is missing in the ushare.conf file contained in the tar.

Prefix these statements with "USHARE_" in your configuration file to get them to work correctly.

LibUPnP-1.6.4 released

Version 1.6.4 of libupnp has been released. Here's my simultaneous streaming to multiple devices patch updated for this version:

--- libupnp-1.6.4.old/upnp/src/api/upnpapi.c 2007-11-27 04:56:02.000000000 +0000
+++ libupnp-1.6.4/upnp/src/api/upnpapi.c 2007-12-28 16:12:16.000000000 +0000
@@ -264,6 +264,8 @@
return UPNP_E_INIT_FAILED;
}

+ TPAttrSetMinThreads( &attr, 4 );
+
if( ThreadPoolInit( &gMiniServerThreadPool, &attr ) != UPNP_E_SUCCESS ) {
UpnpSdkInit = 0;
UpnpFinish();