Kodi Community Forum
Virtual Python Folders - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: Virtual Python Folders (/showthread.php?tid=27760)

Pages: 1 2 3 4 5 6 7 8 9


- Unbehagen - 2007-08-19

jmarshall Wrote:Ideally we'd have more than one script (i.e. not just AMT) ready to go as examples so that people can get cracking on testing it out straight away.
I'd have my TVLinks and Joox plugins ready, but I'll be on holidays until next week. If anyone is in the mood, please feel free to change the plugins I posted to the new plugin API. I'd like to see this in T3CH as early as possible, so maybe we could add the context menu stuff later?
BTW: I talked to the XBMCScripts guys and they are currently developing a new and shiny XBMCScripts. They sounded very positive it will also have plugin installation support.
2


- Nuka1195 - 2007-08-19

I think we need to have more format parameters first. I'm not sure how to add tehm?

I think what ever the sort method is should be label2.

We also need AddSortMethod() finished up, I'll work on that this morning.

I agree that context menus and context buttons, can come later.


- Nuka1195 - 2007-08-19

I have all the sort methods I could find parameters for done.

Would a switch block be better or faster? It might be easier to read. If so I can change it.

We need MPAARating format parameter, maybe others, but atleast that one.

Also a Count SORT_METHOD and parameter.

I know how to add the SORT_METHOD Smile, but where do you add the format parameters?

Code:
[SIZE=2][COLOR=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_LABEL_IGNORE_THE || sortMethod == SORT_METHOD_LABEL)
{
[/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
dir->m_listItems.AddSortMethod(SORT_METHOD_LABEL_IGNORE_THE, 551, LABEL_MASKS("%T", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else
[/color][/SIZE][SIZE=2]
dir->m_listItems.AddSortMethod(SORT_METHOD_LABEL, 551, LABEL_MASKS("%T", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2]
}
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_TITLE_IGNORE_THE || sortMethod == SORT_METHOD_TITLE)
{
[/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
dir->m_listItems.AddSortMethod(SORT_METHOD_TITLE_IGNORE_THE, 556, LABEL_MASKS("%T", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else
[/color][/SIZE][SIZE=2]
dir->m_listItems.AddSortMethod(SORT_METHOD_TITLE, 556, LABEL_MASKS("%T", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2]
}
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_ARTIST_IGNORE_THE || sortMethod == SORT_METHOD_ARTIST)
{
[/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
dir->m_listItems.AddSortMethod(SORT_METHOD_ARTIST_IGNORE_THE, 557, LABEL_MASKS("%A", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else
[/color][/SIZE][SIZE=2]
dir->m_listItems.AddSortMethod(SORT_METHOD_ARTIST, 557, LABEL_MASKS("%A", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2]
}
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_ALBUM_IGNORE_THE || sortMethod == SORT_METHOD_ALBUM)
{
[/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (g_guiSettings.GetBool("filelists.ignorethewhensorting"))
dir->m_listItems.AddSortMethod(SORT_METHOD_ALBUM_IGNORE_THE, 558, LABEL_MASKS("%B", "%A")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else
[/color][/SIZE][SIZE=2]
dir->m_listItems.AddSortMethod(SORT_METHOD_ALBUM, 558, LABEL_MASKS("%B", "%A")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2]
}
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_DATE)
dir->m_listItems.AddSortMethod(SORT_METHOD_DATE, 552, LABEL_MASKS("%T", "%J")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_SIZE)
dir->m_listItems.AddSortMethod(SORT_METHOD_DATE, 553, LABEL_MASKS("%T", "%I")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_FILE)
dir->m_listItems.AddSortMethod(SORT_METHOD_FILE, 561, LABEL_MASKS("%T", "%F")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_TRACKNUM)
dir->m_listItems.AddSortMethod(SORT_METHOD_TRACKNUM, 554, LABEL_MASKS("%T", "%N")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_DURATION)
dir->m_listItems.AddSortMethod(SORT_METHOD_DURATION, 555, LABEL_MASKS("%T", "%D")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_VIDEO_RATING)
dir->m_listItems.AddSortMethod(SORT_METHOD_VIDEO_RATING, 563, LABEL_MASKS("%T", "%R")); [/SIZE][SIZE=2][color=#008000]// Filename, Duration | Foldername, empty
[/color][/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_VIDEO_YEAR)
dir->m_listItems.AddSortMethod(SORT_METHOD_VIDEO_YEAR, 345, LABEL_MASKS("%T", "%Y"));
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_SONG_RATING)
dir->m_listItems.AddSortMethod(SORT_METHOD_SONG_RATING, 563, LABEL_MASKS("%T", "%R"));
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_GENRE)
dir->m_listItems.AddSortMethod(SORT_METHOD_GENRE, 515, LABEL_MASKS("%T", "%G"));
[/SIZE][SIZE=2][color=#0000ff]else[/color][/SIZE][SIZE=2][color=#0000ff]if[/color][/SIZE][SIZE=2] (sortMethod == SORT_METHOD_VIDEO_TITLE)
dir->m_listItems.AddSortMethod(SORT_METHOD_VIDEO_TITLE, 515, LABEL_MASKS("%T", "%D"));
[/SIZE]



- Nuka1195 - 2007-08-19

I changed it to a switch block and committed. found a couple mistakes doing that.


- Nuka1195 - 2007-08-19

This may be getting big enough to warrant it's own module as Unbehagen suggested.

plugin.addDirectoryItem()

Then I think adding the SORT_METHOD's as constants would be a good idea.


- jmarshall - 2007-08-20

Sure - go for it.

Also, I kinda like the short and sweet version better, in that the AddSortMethod() is done within the case's rather than waiting till the end - makes it easier (IMO) to quickly find what you want.

This is a personal thing though, and I'm happy to leave it as-is if you find it easier to read that way around.

Cheers,
Jonathan


- Nuka1195 - 2007-08-20

I find the switch easier, not necessarily the way I did it. I'll put the actual call in the case's no problem.


- jmarshall - 2007-08-20

It's in SVN now Smile

Here's the release thread:

http://forum.xbmc.org/showthread.php?p=146025#post146025

Let's continue any further discussion (hopefully with a few more contributions) there.

Cheers,
Jonathan