FAQ  •  Register  •  Login

Reordering Online Sources

<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Fri Dec 09, 2011 5:03 am

Reordering Online Sources

Seems one can use the REST interface to access the list of online sources.
Each of the sources has an ID number and adds have no ID so I assume they will acquire the next available sequential number.

My question is what is the order of display on the menus? Is it in ID order within each category Video, Audio,Image, RSS, Live, WEB?

My goal is to order the feeds in my own way and not in the order the ID's were sequentially assigned, so can I simply change the ID's so that the feeds are now numbered in the order I wish them displayed and then put them back?

Does the put have to be the same number of items, or can some IDs be dropped(Deletions) and some new IDS used(Additions)?
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Dec 09, 2011 9:23 am

Re: Reordering Online Sources

as pre the spec, no ID = new item, existing ID = update. You cannot change ID. In order to do the ordering I'd have to add another column to the DB table, but it would be probably outside the REST API and would depend on what order the client sends the list of repositories.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Fri Dec 09, 2011 3:39 pm

Re: Reordering Online Sources

So I read that as meaning the "put" must be in ID order, so the contents must be swapped rather than the id's.

Given that restriction, and the restriction on the current console of adding a duplicate url, which effectively prohibits an edit1/copy1/edit2/copy2/paste1in2 approach then the easiest solution would be to "get" all then "put" back without any online sources(delete them all) and then add the online sources back without ids in the order that I want them to display on the menus.

The other approach would be to create an initial list with many empty but inactive online sources (unique dummy url's) between the inital active entries and to fill the empty slots by editing and activating new entries in the preferred location. This is not ideal but would eliminate much of the need to reorder using the first approach.

An amalgam would be to have the first solution also add dummies when putting back the reordered list.

I'll experiment with this and post results here, so that I don't do or recommend things that run afoul of your design. Thanks for your feedback.
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Fri Dec 09, 2011 4:49 pm

Re: Reordering Online Sources

this is a terrible hack ;-) you'll lose all your cached feeds (as a result of the delete operation) and they'll have to be parsed again
<<

kairoh

DLNA master

Posts: 180

Joined: Sun Aug 08, 2010 10:41 am

Location: France

Post Fri Dec 09, 2011 5:06 pm

Re: Reordering Online Sources

Zip, you could add a new column in the DB to store the "user sequence order" and leave the primary key intact.
By default this number could be set to the primary key (or not?).
Of course this will be in a future release...
Serviio WebUI console developer : New Homepage | Support | Project | Issues

Samsung UA32C6600 | WinXP / Ubuntu 11.10 | Samsung Galaxy S | Freebox v6
HowTo: Provide supported formats of a device HowTo: Record a new ticket on Bitbucket
HowTo: Provide details of a video file that doesn't play HowTo: Turn on detailed logging
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Fri Dec 09, 2011 5:08 pm

Re: Reordering Online Sources

I know its a sledgehammer approach but I see no other way to get there.

The amalgam approach would require this rebuild to be done only periodically and I'm assuming its no different than if Serviio was restarted after the feed expiry period and all the feeds need to be recached anyway.

However I am first trying to see if I can build a hotkey move up/move down capability using AutoIt on the Console GUI, but it also seems to me that while this is the easyiest implementation, it will also result in recaching the two feeds involved in each move as well. I'll post results as I test this.

As you have said I think the only way to avoid recaching is via database additions that dictate the ordering of the console and menu displays but leave the cached ID's alone. I think that should be done according to a consensus on priority of the features I have proposed and I'll live with a terrible hack until then :(
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Sat Dec 10, 2011 2:05 am

First Results.

I can now achieve a moveup or movedown with 15 steps that can be easily automated with AutoIt. Now that I have proved the concept, my next step will be to create those hotkey scripts.

My findings however have more to do with Serviio's behaviour in handling online sources, and I think identify some bugs/omissions/or redundant behaviour, so I will report them here for zips review, and attach the complete log as referenced below. (line numbers are available using notepad+ to edit the log)

First, I turned on debug for the online library and restarted Serviio
  Code:
<category name="org.serviio.library.online">
      <priority value="DEBUG"/>
   </category>


Observation 1: All my existing online feeds are identified as "not in cache yet, loading it", then reparsed, the contained fees added and then stored in the cache and the expiry set. It then finds "Found technical metadata for online item.. in the cache" which was retained for the feed so the parsing/caching is faster than for a new feed. This takes the log to line 1478 and required 2 minutes and 25 seconds from Serviio startup.
Serviio then confirms up to line 1511 that the 31 feeds are cached.

Then the log becomes weird...!!!

Observation 2: Every minute the 31 feeds are reconfirmed, this is repeated 17 times, then only the 18 video rss feeds, followed by the 2 video live streams are confirmed, then just the 18 video rss feeds, then the 18 plus the first rss feed, then various combinations of the above. I see no rhyme or reason for this variation or for the need to confirm all the feeds every 60 seconds.

I then proceeded to test some changes:

Test 1: simply changed (edit/add/save) the "Display name" of an existing feed (as available in beta3). The name changed in the TV menu immediately (exit and reopen OnlineFeeds), but no log entry is created for that action.

Test 2: I simply changed(edit/add/save) the "Source URL" of an existing feed (as available in beta3). The new log showed the old url deleted (line 4335) and the the new url added and reparsed.(lines 4364 to 4379)

Observation 3: The reparsing of the new url which had never been added to Serviio before and the addition and caching of its feeds was exactly the same as the parsing of the original url at Serviio startup. This new url had the same content as the old url and Serviio again "Found technical metadata for online item .. in the cache" for those items.

Then the log becomes weird again!

Observation 4: Following the addition of the new feed, the 31 feeds are again confirmed as cached one minute later, then in 36 seconds, then in 24, then in 16, then in 3, then 7 times within 1 second, then 10 seconds later 7 more times in 1 second, then 7 more times within 1 second, then 30 seconds later, then back to the 1 minute cycle, so we get a flurry of 26 confirmation cycles over 2 minutes... it just makes no sense. (lines 4384 thru 4824)

Test 3: Performed the 14 step "moveup" of an existing feed item within the console and then saved. The log shows the two swapped feeds being reparsed and the feeds added again the same as when these urls were parsed at startup (lines 7227 thru 7268) But again Serviio "Found technical metadata for online item .. in the cache" so it seems that the reordering of items still uses the retained information for the items in the reordered feeds, meaning reordering is no more intensive than a Serviio startup.

Observation 5: After these adds the confirmation that the feeds are in the cache goes bananas again with 20 some cycles being done over a minute or so. (lines 7288 thru 7707). Again makes no sense. The cycle then repeats every 60 seconds.
Attachments
serviiofeeds.log.zip
(91.65 KiB) Downloaded 375 times
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sat Dec 10, 2011 3:56 pm

Re: Reordering Online Sources

cool. I think it's all working then, right ? ;-) The 'confirmations' in the log are just print outs whenever Serviio looks for the feed URL in the cache. The 1 minute intervals are there because Serviio checks every minute if any of the feeds expired (just loops through all and tries to find them in the cache - thus the log). The other printouts of the same are most likely caused by you browsing the feeds on the TV as - again - when the TV asks for feed information Serviio looks to the cache for it.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Sat Dec 10, 2011 4:25 pm

Re: Reordering Online Sources

Well I wish you would kill the messages where it says it found the feed in the cache and give just one message each minute reporting that the feeds are all being checked for presence in the cache and only report when the feed is not found in the cache or when the feed has expired. Same result, much cleaner log.

Also that flurry of cache checks (23 cycles of all feeds within 2 minutes) has nothing to do with the TV. It happens after each console feed edit/change as shown in that log with the TV off. Serviio is definitely going nuts. I have not monitored the cpu load but there is some redundant looping going on.

Other than that the moveup/movedown works great, reuses the cached info for each moved feed and creates no more load than it would have at startup. I'll try and work on the Autoit hot keys today. I'm also thinking as I type that a "move to bottom" hotkey would allow easy reordering. Just edit the highlited feed to save the content, delete the feed and then add it back to the bottom. Do this for all the feeds in the order you want the final list. '
Maybe even an "add last feed here" hotkey. Just add a new feed and then highlite where you want it in the list and hit the hotkey which would automatically move all following feeds to the bottom sequentally so the last added feed moves up to that location.... Wow..I'm getting excited about this, terrible hack that it is!
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Sun Dec 11, 2011 2:38 pm

Re: Reordering Online Sources

I removed some of the logging, but after a bit of investigation it's hard to see what's going on as you only have DEBUG log for the online package.
<<

jhb50

DLNA master

Posts: 2843

Joined: Thu Jun 30, 2011 9:32 pm

Post Sun Dec 11, 2011 6:25 pm

Re: Reordering Online Sources

zip wrote:I removed some of the logging, but after a bit of investigation it's hard to see what's going on as you only have DEBUG log for the online package.


I recall getting the error links reported every minute when Debug was off.
The only thing to turn off is the found in cache message for each link in debug mode, the error messages should stay for normal log and debug, and add a message in debug when you start to checking of the feeds for being in the cache so we only get one message every minute not one per feed. That tells us the checking is going on and shows any errors. Should be enough.

Return to Third-party tools integration

Who is online

Users browsing this forum: No registered users and 16 guests

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.