Home of the Squeezebox™ & Transporter® network music players.
Results 1 to 4 of 4
  1. #1

    Using Image Viewer to Display Photos from Synology NAS

    This is a little work in progress but I thought I'd share what I'd done so far...

    I'd like to use my SB players as digital photo frames too (especially the Joggler which has a 7" screen), displaying my images from my Synology DS213+ NAS.

    I found http://forums.slimdevices.com/showth...5-image-viewer which had an idea for generating the .lst file for Image Viewer from Flikr (or other online album with an API) but all my photos are local to the NAS. Note I hadn't seen mherger's Gallery Plug-in (http://www.herger.net/slim-plugins/) at the time.

    Anyway, Synology has an app called Photo Station which automatically creates thumbnails and so seem suited to display on Squeezebox displays. However as yet I haven't worked out how to get Photo Station URLs for images so for now I thought I'd just find a simple way from my photo folders. Syno also has a DLNA app called Media Server, which includes a lighttpd server listening on port 50002 and with htdocs root dir at /var/packages/MediaServer/target/etc

    The Synology default thumbnail files are stored in a @eaDir directory within each photo directory, like this:
    Code:
    nas3> ls -l @eaDir/DSC00474.JPG/
    -rwxrwxrwx    1 root     root         64212 Jan 16 10:36 SYNOPHOTO:THUMB_B.jpg
    -rwxrwxrwx    1 root     root        149043 Jan 16 10:36 SYNOPHOTO:THUMB_L.jpg
    -rwxrwxrwx    1 root     root         25034 Jan 16 10:36 SYNOPHOTO:THUMB_M.jpg
    -rwxrwxrwx    1 root     root          3807 Jan 16 10:36 SYNOPHOTO:THUMB_S.jpg
    -rwxrwxrwx    1 root     root        328279 Jan 16 10:36 SYNOPHOTO:THUMB_XL.jpg
    Their sizes are:
    * _S 120x81
    * _M are 320x215
    * _B are 640x429
    * _L are 800x536
    * _XL are 1280x857

    Squeezebox screen sizes:
    * Joggler screen size: 800x480 => _L
    * SB Touch screen size: 480 x 272 => _B
    * SR Radio: 320 x 240 => _M
    * (SB Controller: 240x320 => _M though not really suited as a viewer anyway)

    So firstly what I did (via SSH) was to create a link so that my top level photos directory was visible through lighttpd:
    Code:
    ln -s /volume1/photo /var/packages/MediaServer/target/etc/
    (this I guess may get lost with DSM upgrades). Then I created a /volume1/photo/config directory. Finally I wrote a small shell script to create a sb<model>.lst URL file:
    Code:
    WriteSbFile() {
            LIST_FILE=$1.lst
            THUMB_SIZE=$2
    
            # empty file
            echo > $LIST_FILE
    
            for PHOTO in `find /volume1/photo/2012 -name "*THUMB_$THUMB_SIZE.jpg" | sed 's@ @\%20@g'`
            do
                    # replace the /volume1 with the media server ligthttpd URL
                    PHOTO_URL=`echo $PHOTO | sed 's@/volume1@http://mynas:50002@'`
                    echo $PHOTO_URL
                    echo $PHOTO_URL >> $LIST_FILE
    
            done
    
            echo "Created this file for Squeezebox Image Viewer:"
            ls -l $LIST_FILE
    }
    
    WriteSbFile /volume1/photo/config/sbjoggler L
    WriteSbFile /volume1/photo/config/sbtouch B
    WriteSbFile /volume1/photo/config/sbradio M
    Of course this is still a manual process to generate the .lst files so not ideal.

    Then for the Image Viewer source specific settings I use, e.g.: http://mynas:50002/photo/config/sbjoggler.lst

    This seems to work OK (and most pictures seem to be the right way up) but it's only really a first step - ideally you'd want:
    1) Find a mechanism for only displaying favourites or some sort of random selection
    2) I assume I don't want the URL list to be too large, i.e. not 1000s - maybe it can be a PHP URL and only return 1 URL at a time (does the Image Viewer app download the .lst once or for every transition?)

    The good thing about this approach is the NAS has already done the image processing work to create the smaller versions of the images so it doesn't put much load on the player when running the slide show. It does really need access to use the Photo Station database (Postgres) though so that it can have some sort of search mechanism (I use Picasa too but I think Photo Station is probably the easiest way to do this). Finally ideally you'd package it up into a Synology app I suppose.

    Anyway, as I say it's work in progress but please let me know if I'm going up the wrong path ;-)
    Players SB Radio 7.7.3-r16676 (bedroom/alarm), SqueezePlayOS v? on O2 Joggler (kitchen), SB Touch 7.8.0-r16754/Quad 606/Heybrook .5 (office)
    Server LMS 7.9.0-1433513811 on Synology DS213+ NAS. Library ~4000 tracks & but mostly listen to BBC.

  2. #2
    Senior Member
    Join Date
    Dec 2008
    Posts
    276
    Fantastic idea would be great to have our synology photos displayed too!

  3. #3

    Updates for DSM 4.2/Photo Station 5.2

    OK, this technique has just broken with the update to DSM 4.2 and Photo Station 5.2. It looks as though there's been a lot of change for Photo Station which is now accessed through port 80 (and Apache instead of Lighttpd), though the thumbnails are still stored on the filesystem (and generated in the background as before). When Photo Station retrieves a thumbnail it uses convert.php which has some long ID parameters, but if you look in the script you'll see it's converting it to @eaDir (at least for standard images).

    Apache uses this config file for Photo Station URLS: /usr/syno/etc/sites-enabled-user/SYNO.SDS.PhotoStation.conf

    At the top I have included a new re-write rule:
    Code:
    AliasMatch ^/thumbnail/(.*) "/volume1/photo/$1"
    This means that http://<mynas>/thumbnail/... will become /volume1/photo/...

    Now get Apache to re-read its config - find the top process:
    Code:
    netstat -pan |grep 80
    Look for the Apache process (e.g. LISTEN 28625/httpd) and do:
    Code:
    kill -HUP <process-id-from-netstat>
    Finally I've now changed my script to:
    Code:
    WriteSbFile() {
            LIST_FILE=$1.lst
            THUMB_SIZE=$2
    
            # empty file
            echo > $LIST_FILE
    
            for PHOTO in `find /volume1/photo -name "*THUMB_$THUMB_SIZE.jpg" | sed 's@ @\%20@g'`
            do
                    # replace the /volume1 with the media server ligthttpd URL
                    PHOTO_URL=`echo $PHOTO | sed 's@/volume1/photo@http://mynas/thumbnail@'`
                    echo $PHOTO_URL
                    echo $PHOTO_URL >> $LIST_FILE
    
            done
    
            echo "Created this file for Squeezebox Image Viewer:"
            ls -l $LIST_FILE
    }
    
    WriteSbFile /volume1/photo/config/sbjoggler L
    WriteSbFile /volume1/photo/config/sbtouch B
    WriteSbFile /volume1/photo/config/sbradio M
    I hope this helps someone. At some point I want to come up with a better method for selecting photos but this will do for now and I am enjoying often seeing my photos on my O2 Joggler in the kitchen. It would be nice to have an API from Synology though...
    Players SB Radio 7.7.3-r16676 (bedroom/alarm), SqueezePlayOS v? on O2 Joggler (kitchen), SB Touch 7.8.0-r16754/Quad 606/Heybrook .5 (office)
    Server LMS 7.9.0-1433513811 on Synology DS213+ NAS. Library ~4000 tracks & but mostly listen to BBC.

  4. #4

    Update for PhotoStation 6.0-2626 / DSM 4.3-3810 (and probably a bit earlier)

    There's been a permission change in a DSM/PhotoStation update that denies access to the @eaDir directories so you now also need to change /usr/syno/etc/sites-enabled-user/SYNO.SDS.PhotoStation.conf to say:
    Code:
    # For @eaDir
    <DirectoryMatch "@eaDir">
    Order allow,deny
    # Change deny to allow below:
    Allow from all
    Satisfy All
    </DirectoryMatch>
    I should really write it as a standalone package one day...
    Players SB Radio 7.7.3-r16676 (bedroom/alarm), SqueezePlayOS v? on O2 Joggler (kitchen), SB Touch 7.8.0-r16754/Quad 606/Heybrook .5 (office)
    Server LMS 7.9.0-1433513811 on Synology DS213+ NAS. Library ~4000 tracks & but mostly listen to BBC.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •