Use my own pictures in the Screen Saver

From LinuxMCE
Revision as of 14:12, 18 October 2007 by Bongfrog (Talk | contribs)

Jump to: navigation, search

The photo screen saver does a great job and ensures that media is displayed all the time, even if you just happen to be listening to music. By default, the photos come from flickr and are downloaded regularly to your local drives.

But it would be nice to use your own photos in this screen saver, perhaps alongside the flickr ones or perhaps as a replacement.

This is a guide to do just that...


Background

All media on your linuxMCE system is catalogued and stored in a database. The database allows for attributes to be stored for each media file. One such attribute is "Screen Saver For MD". By setting this attribute this picture will be used as one of the pictures for the Media Director Screen Saver. Photos are selected by random from all the photos that exist with the "Screen Saver For MD" attribute set.

There are a number of ways to set this attribute for individual files. They are;

  • Setting an attribute from the web admin screens
  • Setting an attribute from the command line
  • Assigning a picture to the screen saver from the Orbiter


Setting an attribute from the web admin screens

There is a section on the web admin screens that allow the setting of attributes for media. It is available under Files & Media -> Media Files Sync

The left hand window frame gives a tree view into the directory structure of home/public/data. Typically photos will be stored under the pictures sub-directory. The right hand window frame gives a view of the files found and their status with relation to linuxMCE's database.

Firstly determine the pictures you wish to use, and locate them using the directory browser. Then ensure that the files are ticked to indicate existing in both the database and on disk. If not then choose the type as 'LinuxMCE Pictures' and press the 'Add to database' button.

Once they are added to the database you should be able to select them and see the details (metadata) associated with them.

Part of the details include any currently set attributes for the file, which you can choose to Edit or Remove. There is also a section to Add Attributes. Only attribute that have been associated with the particular file types can be selected from the drop down box. Note: If you do not see 'Screen Saver For MD' in this box then you will need to Associate the attribute.

Select the attribute 'Screen Saver For MD' and enter or select the Attribute name value of '*'. Then press the Add button next to the box and your done.

A quick reload router should be enough to ensure that files are refreshed from the database and you should start to see your selected picture as one of the screen saver files.

Associate the attribute

Unfortunately by default this attribute has not been associated with the picture media type. Perhaps a bug, who knows. Anyway, to associate it you will need to run the following piece of SQL to put the required association into the database.

You will need to get to the command prompt of your CORE machine and from the command prompt (your default user should be fine) run:

mysql -u root -D pluto_media -N -e "INSERT into MediaType_AttributeType(EK_MediaType, FK_AttributeType, Identifier, CombineAsOne) values(7,30,0,1)"

Do a quick reload router and then the attribute should show up in the dropdown box under add attributes

Note: If someone knows a better way to do this or can see some adverse side effects please update

Setting an attribute from the command line

There is functionality built into the system that allows an attribute to be set through a sequence of Command Messages sent to the right device. This is what the flickr.pl script uses to assign the downloaded files the right attributes. The commands can be executed from anything that can send linuxMCE messages (including the web admin screens) but this method will utilise the MessageSend utility available from the linux command line.

You will need to firstly determine the full filename and path for the file you wish to set the attribute for. This method assumes that the file has already been sync'd with linuxMCE and exists in the data base.

The first command queries the database for the file ID of a particular filename.

The second command assigns an attribute type/value to the returned file ID

  • Logon to your linuxMCE CORE and get to the linux command prompt
  • execute the following command
/usr/pluto/bin/MessageSend dcerouter -targetType template -r -o 0 2 1 819 13 <pathtofile>

Substituting your full path to the file where is says <pathtofile>

eg: /usr/pluto/bin/MessageSend dcerouter -targetType template -r -o 0 2 1 819 13 /home/public/data/pictures/sample.jpg

You should get a response something like this:

0:OK
145:11392

The number next to the '145:' is the important part. This is the fileID. If this is zero then your command has not found a match in the database and you may need to take other measures to ensure that the database is sync'd with your files.

  • Now execute the following command
/usr/pluto/bin/MessageSend dcerouter -targetType template -r -o 0 2 1 391 145 <fileID> 122 30 5 "*"

Substituting the fileID that you just discovered where it says <fileID>

eg: /usr/pluto/bin/MessageSend dcerouter -targetType template -r -o 0 2 1 391 145 11392 122 30 5 "*"

  • You can then repeat for any other files that you want to use

Note: Someone might like to write a user friendly script that simplifies this task

Assigning a picture to the screen saver from the Orbiter

Sounds like a good idea??? Unfortunately it is not currently possible, but I thought that this sounded like a logical thing to do so have put this placeholder in.

Essentially, screens in the Orbiter have buttons that trigger message Command to be sent. So setting up a button in the Picture view screen "add to Screen Saver" should be quite straight forward.

If you feel like getting involved maybe this is somewhere you can start.....

NOTE: Pictures must be smaller than 1240 x 1240. Hope this saves some a bit of fustration.