Add sort by date added on movies library mode?

  Thread Rating:
  • 2 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
BigBlack Offline
Senior Member
Posts: 126
Joined: Aug 2009
Reputation: 0
Post: #71
I'll try and let you know! Thank you! Wink
find quote
booker88 Offline
Junior Member
Posts: 30
Joined: Jul 2009
Reputation: 14
Location: Philippines
Post: #72
Worked great for me.

Using Dharma 10 Final on MS Server 2008.

Thanks!

I hope you'll look at posting your plugin in the plugin subforum as I'm sure there must be many more users that could benefit from it.

jmphx Wrote:Hi all,

I'm somewhat new to XBMC (~2 months), having come from MediaPortal years ago, and Windows Media Center most recently. I love XBMC, but like many in this thread, I wanted the Movie Library's "Date Added" sort method to reflect the dates I added the movies to my filesystem and not the date that XBMC imported them.

I ended up making an XBMC script (addon?) that is working fairly well for me, so far. I call it: script.sortmoviesbyfiledate

I have done limited testing, so you are forewarned!!

You should backup your Database files before using this script!!!!!
(eg: win7/vista: c:\users\<username>\AppData\Roaming\XBMC\userdata\Database\*.db)

The script is fairly simple. The way it works is:

1) Query the Movie Library, get all movies' idMovie, idFile, filename
2) Lookup each filename's create-time timestamp (CTIME)
3) Sort the resulting movie list by timestamp
3) In the database: change each movie's idMovile and idFile to match the order in our sorted list. We do this by shifting the id's higher in both the 'movie' and 'file' table. If you had 100 movies in your library, their original id's were probably 1-100, but they will now be 101-200, however the order will now reflect the timestamp from the movie file.

At first I tried only changed the 'idMovie' columns in the 'movie' table of the sqlite db, but this only changed the 'recently added' plugin's order. The actual sorting by 'Date Added' was still wrong until I also changed the order of the 'idFile' columns in the 'file' table.

I have only tested this on Win7/XBMC-10.0, and all of my movies are remotely stored and access via SMB. I assume this code will work for local-files and possibly other types, but it really depends on the interaction between xbmc.makeLegalFilename() and python's os.stat()

I'm interested in feedback. Patches are even more welcome =) If you have a patch to submit, please clone the repo, create a topic branch, and send me a pull request.

more documentation, including install and usage directions, available on github:
https://github.com/joemiller/xbmc-script...-file-date

https://github.com/joemiller/xbmc-script...-file-date
find quote
booker88 Offline
Junior Member
Posts: 30
Joined: Jul 2009
Reputation: 14
Location: Philippines
Post: #73
Actually... took another look at it realized that the script didn't keep the actors linked.

Restored my backup video db and everything is ok again.

Hope you can tweak the script to include the actorlinkmovie table.

Cheers.

booker88 Wrote:Worked great for me.

Using Dharma 10 Final on MS Server 2008.

Thanks!

I hope you'll look at posting your plugin in the plugin subforum as I'm sure there must be many more users that could benefit from it.
find quote
myrison Offline
Member+
Posts: 301
Joined: Nov 2009
Reputation: 3
Location: Austin, TX
Post: #74
Great idea for an addon. Count me in as very interested as well, especially if the actor link can be fixed. I just had to recreate my library and would love to resort them all by created date.

------------------------------------------
Dharma Quick Setup Guide:
XBMC tips on the TechNazgul Blog
------------------------------------------
find quote
BigBlack Offline
Senior Member
Posts: 126
Joined: Aug 2009
Reputation: 0
Post: #75
BigBlack Wrote:I'll try and let you know! Thank you! Wink

mmm It had moved something but some new movies are in the middle of other olde ones.... So it doesn't work very well for me Sad

But when I click on the addon i must see something like a percentage bar? O something else? Or nothing? I don't see nothing...
find quote
wonko Offline
Member+
Posts: 45
Joined: Nov 2007
Reputation: 0
Location: Germany
Post: #76
Hi,

unfortunatly, this seems to break movie sets:

http://wiki.xbmc.org/index.php?title=Movie_Sets
find quote
BigBlack Offline
Senior Member
Posts: 126
Joined: Aug 2009
Reputation: 0
Post: #77
mmm I don't understand why some movies are arranged well and other no.... some ideas?
find quote
Kvaks Offline
Junior Member
Posts: 19
Joined: Jan 2011
Reputation: 0
Post: #78
I too prefer to list movies by date added. I'd prefer to use the file creation timestamp, but the current implementation is good enough most of the time. Except that I'd like the reverse sort order. Most recent movies at the top, so that they'd appear right away without scrolling for them. Cycling through the sort options, this doesn't seem to be possible. Any chance it will be added?
(This post was last modified: 2011-03-22 00:59 by Kvaks.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #79
git HEAD allows the files view to show full movie information, complete with sort by date.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
carmatana Offline
Junior Member
Posts: 37
Joined: Jan 2011
Reputation: 0
Post: #80
Hi,

Great !!! Looking for this since long time. Any clue how to run it in Mac OSX Snow Leopard.

I tried it but no success. In the log file there is a "Exception: Could not get AddonPtr!"
message.

Also wonder if the script sorts by FOLDER creation date. I have a folder per movie and I would like to have the Folder creation date as the sort key.

I have had to recreate some damaged file movies or move the filemovie to a different container (dvd > mkv) or sound format to make compatible with xbox and this changes both the creation and the modification date of the file but the Folder info is untouched.

Thanks in advance
(This post was last modified: 2011-04-19 05:19 by carmatana.)
find quote
Post Reply