v19 Sort by last played in movie library
#1
I'm trying to replace playlists included in the skin with hardcoded content paths.

But I can't figure this problem out. Now I can't even think straight anymore, so I hope I have just missed something obvious.


My content path is:
Code:
ActivateWindow(Videos,videodb://movies/titles/?xsp=%7b%22order%22%3a%7b%22direction%22%3a%22descending%22%2c%22ignorefolders%22%3a0%2c%22method%22%3a%22lastplayed%22%7d%2c%22rules%22%3a%7b%22and%22%3a%5b%7b%22field%22%3a%22inprogress%22%2c%22operator%22%3a%22true%22%2c%22value%22%3a%5b%5d%7d%5d%7d%2c%22type%22%3a%22movies%22%7d)

My playlist path is:
xml:

ActivateWindow(Videos,special://skin/extras/playlists/InProgressMovies.xsp)

The content of the playlist is:
xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
    <name>In Progress Movies</name>
    <match>all</match>
    <rule field="inprogress" operator="true" />
    <order direction="descending">lastplayed</order>
</smartplaylist>


The problem is:
- When I enter the library using the playlist, everything is fine and the content is sorted by lastplayed.
- When I enter the library using the path, the content is sorted by dateadded, and the option to sort by lastplayed is not available at all.


Any idea to what is happening?
I'm going crazy Big Grin
Reply
#2
unsure if even possible for activate window method.

but
a)
a shot in the blue - add &amp;
e.g.
ActivateWindow(Videos,videodb://movies/titles/&amp;?xsp=%7b%22order%22%3a%7b%22direction%22%3a%22descending%22%2c%22ignorefolders%22%3a0%2c)


b) maybe syntax error
test with that template

oring example / playlist replace
albumartist contains label or album contains label
{"rules":{"or":[{"field":"albumartist","operator":"contains","value":["$INFO[Control.GetLabel(100002).index(1)]"]},{"field":"album","operator":"contains","value":["$INFO[Control.GetLabel(100002).index(1)]"]}]},"type":"albums"}

(use mme tool from notepad to decode
and give attention to missing
%2C = ,
%5B = [
%5D = ]
encoded symbols
or use an url encode site, like https://www.google.com/amp/s/amp.urlencoder.org/
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#3
Hi mardukL.

Thanks for the answer.

Adding &amp; breaks it completely.

I created the in progress movies node with library node editor, and the node itself works. But using the same node with ActivateWindow doesn't. Also using it as content in a container doesn't work.
Using this in a container works:
Code:
<content sortby="lastplayed" sortorder="descending">
videodb://movies/titles/?xsp=%7b%22rules%22%3a%7b%22and%22%3a%5b%7b%22field%22%3a%22inprogress%22%2c%22operator%22%3a%22true%22%2c%22value%22%3a%5b%5d%7d%5d%7d%2c%22type%22%3a%22movies%22%7d
</content>

The problem is, that the path works, but that sorting by lastplayed is missing completely from the sort methods, when using it.
@ronie has found out that sort by lastplayed is not part of Kodi's sort methods.

So why it exists for playlists and nodes is a mystery to me.
Reply
#4
than, i have currently no idea, .

but i wonder about the 'last played' statement,

https://kodi.wiki/view/List_of_built-in_...rt_methods
https://github.com/xbmc/xbmc/blob/master...#L529-L577

container.setsortmethod()
1 Name
2 Date
3 Size
4 File
5 Path
6 DriveType
7 Title
8 TrackNumber
9 Time
10 Artist
11 ArtistThenYear
12 Album
13 AlbumType
14 Genre
15 Country
16 Year
17 Rating
18 UserRating
19 Votes
20 Top250
21 ProgramCount
22 PlaylistOrder
23 EpisodeNumber
24 Season
25 NumberOfEpisodes
26 NumberOfWatchedEpisodes
27 TvShowStatus
28 TvShowTitle
29 SortTitle
30 ProductionCode
31 MPAA
32 VideoResolution
33 VideoCodec
34 VideoAspectRatio
35 AudioChannels
36 AudioCodec
37 AudioLanguage
38 SubtitleLanguage
39 Studio
40 DateAdded
41 LastPlayed
42 Playcount
43 Listeners
44 Bitrate
45 Random
46 Channel
47 ChannelNumber
48 DateTaken
49 Relevance
50 InstallDate
51 LastUpdated
52 LastUsed
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#5
Hmm, yeah I can confirm that doesn't follow the sort method (I get Sort by: Titles).
Also can confirm that it is the correct path. I used Library Node editor to create it and then used KodiDevKit Display InfoLabel function to copy the Container.FolderPath and it matches your path exactly.

Enter the path through the node and it sorting is correctly applied. Copy that same Container.FolderPath and launch it with ActivateWindow and the sorting isn't applied.
Arctic Fuse - Alpha now available. Support me on Ko-fi.
Reply
#6
sadly i cannot test further on pc, just quick test on phone.

on my end using predefinded
order tags doenst work in activate window, but do for a custom container path


e.g. not working
code:
{"order":
{"direction":"ascending","ignorefolders":0,"method":"year"},
{"rules":
{"or":
[
{"field":"title","operator":"startswith","value":["zur"]},
{"field":"title","operator":"contains","value":["dark"]}
]},
"type":"movies"}

which is
code:
%7B%22order%22%3A%0A%09%7B%22direction%22%3A%22ascending%22%2C%22ignorefolders%22%3A0%2C%22method%22%3A%22year%22%7D%2C%0A%7B%22rules%22%3A%0A%09%7B%22or%22%3A%0A%09%5B%0A%09%09%7B%22field%22%3A%22title%22%2C%22operator%22%3A%22startswith%22%2C%22value%22%3A%5B%22zur%22%5D%7D%2C%0A%09%09%7B%22field%22%3A%22title%22%2C%22operator%22%3A%22contains%22%2C%22value%22%3A%5B%22dark%22%5D%7D%0A%09%5D%7D%2C%0A%09%22type%22%3A%22movies%22%7D


working in activate window
code:
{"rules":
{"or":
[
{"field":"title","operator":"startswith","value":["zur"]},
{"field":"title","operator":"contains","value":["dark"]}
]},
"type":"movies"}

which is
code:
%7B%22rules%22%3A%7B%22or%22%3A%5B%7B%22field%22%3A%22title%22%2C%22operator%22%3A%22startswith%22%2C%22value%22%3A%5B%22zur%22%5D%7D%2C%7B%22field%22%3A%22title%22%2C%22operator%22%3A%22contains%22%2C%22value%22%3A%5B%22dark%22%5D%7D%5D%7D%2C%22type%22%3A%22movies%22%7D


txt:
APPEND:
operator

contains True if the field contains the parameter as a substring
doesnotcontain True if the field does not contain the parameter as a substring
is True if the field matches the parameter exactly
isnot True if the field does not match the parameter exactly
startswith True if the start of the field matches the parameter
endswith True if the end of the field matches the parameter
lessthan True if the content of the field is less than the parameter
greaterthan True if the content of the field is greater than the parameter
after True if the content of the field comes after the parameter
before True if the content of the field comes before the parameter
inthelast True if the field falls in the last range specified by the parameter. Only applicable for a date field.
notinthelast True if the field does not fall in the last range specified by the parameter. Only applicable for a date field.


container.setsortmethod()
1 Name
2 Date
3 Size
4 File
5 Path
6 DriveType
7 Title
8 TrackNumber
9 Time
10 Artist
11 ArtistThenYear
12 Album
13 AlbumType
14 Genre
15 Country
16 Year
17 Rating
18 UserRating
19 Votes
20 Top250
21 ProgramCount
22 PlaylistOrder
23 EpisodeNumber
24 Season
25 NumberOfEpisodes
26 NumberOfWatchedEpisodes
27 TvShowStatus
28 TvShowTitle
29 SortTitle
30 ProductionCode
31 MPAA
32 VideoResolution
33 VideoCodec
34 VideoAspectRatio
35 AudioChannels
36 AudioCodec
37 AudioLanguage
38 SubtitleLanguage
39 Studio
40 DateAdded
41 LastPlayed
42 Playcount
43 Listeners
44 Bitrate
45 Random
46 Channel
47 ChannelNumber
48 DateTaken
49 Relevance
50 InstallDate
51 LastUpdated
52 LastUsed
Skins |  Titan M O D   •   S W A N (WIP)
Reply
#7
(2020-04-05, 10:28)jurialmunkey Wrote: Enter the path through the node and it sorting is correctly applied. Copy that same Container.FolderPath and launch it with ActivateWindow and the sorting isn't applied.

Thanks a lot for testing and for the input.

This is exactly what my conclusion was.

We were discussing this a bit at Slack yesterday.
Let me write here what @ronie found out.

These are the available sort methods defined by Kodi in the movie title node:
https://github.com/xbmc/xbmc/blob/6de683...#L228-L262
xml:

case NODE_TYPE_TITLE_MOVIES:
{
if (params.GetSetId() > -1) // Is this a listing within a set?
{
AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
}
else
{
AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
}
AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
AddSortMethod(SortByUserRating, 38018, LABEL_MASKS("%T", "%r", "%T", "%r")); // Title, Userrating | Title, Userrating
AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
AddSortMethod(SortByTime, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty
AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded

if (CMediaSettings::GetInstance().GetWatchedMode(items.GetContent()) == WatchedModeAll)
AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount

const CViewState *viewState = CViewStateSettings::GetInstance().Get("videonavtitles");
if (params.GetSetId() > -1)
{
SetSortMethod(SortByYear);
SetSortOrder(SortOrderAscending);
}
else
{
SetSortMethod(viewState->m_sortDescription);
SetSortOrder(viewState->m_sortDescription.sortOrder);
}

SetViewAsControl(viewState->m_viewMode);
}

Kodi will add the sort method defined by the <order> tag in a playlist or library node xml:
https://github.com/xbmc/xbmc/blob/6de683...#L455-L456
xml:

if (items.IsSmartPlayList() || items.IsLibraryFolder())
AddPlaylistOrder(items, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
Reply
#8
(2020-04-05, 12:11)Gade Wrote:
(2020-04-05, 10:28)jurialmunkey Wrote: Enter the path through the node and it sorting is correctly applied. Copy that same Container.FolderPath and launch it with ActivateWindow and the sorting isn't applied.

Thanks a lot for testing and for the input.

This is exactly what my conclusion was.

We were discussing this a bit at Slack yesterday.
Let me write here what @ronie found out.

These are the available sort methods defined by Kodi in the movie title node:
https://github.com/xbmc/xbmc/blob/6de683...#L228-L262
xml:

case NODE_TYPE_TITLE_MOVIES:
{
if (params.GetSetId() > -1) // Is this a listing within a set?
{
AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y")); // Title, Year | empty, empty
AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R")); // Title, Rating | empty, empty
}
else
{
AddSortMethod(SortBySortTitle, sortAttributes, 556, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
AddSortMethod(SortByYear, 562, LABEL_MASKS("%T", "%Y", "%T", "%Y")); // Title, Year | Title, Year
}
AddSortMethod(SortByRating, 563, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating
AddSortMethod(SortByUserRating, 38018, LABEL_MASKS("%T", "%r", "%T", "%r")); // Title, Userrating | Title, Userrating
AddSortMethod(SortByMPAA, 20074, LABEL_MASKS("%T", "%O")); // Title, MPAA | empty, empty
AddSortMethod(SortByTime, 180, LABEL_MASKS("%T", "%D")); // Title, Duration | empty, empty
AddSortMethod(SortByDateAdded, 570, LABEL_MASKS("%T", "%a", "%T", "%a")); // Title, DateAdded | Title, DateAdded

if (CMediaSettings::GetInstance().GetWatchedMode(items.GetContent()) == WatchedModeAll)
AddSortMethod(SortByPlaycount, 567, LABEL_MASKS("%T", "%V", "%T", "%V")); // Title, Playcount | Title, Playcount

const CViewState *viewState = CViewStateSettings::GetInstance().Get("videonavtitles");
if (params.GetSetId() > -1)
{
SetSortMethod(SortByYear);
SetSortOrder(SortOrderAscending);
}
else
{
SetSortMethod(viewState->m_sortDescription);
SetSortOrder(viewState->m_sortDescription.sortOrder);
}

SetViewAsControl(viewState->m_viewMode);
}

Kodi will add the sort method defined by the <order> tag in a playlist or library node xml:
https://github.com/xbmc/xbmc/blob/6de683...#L455-L456
xml:

if (items.IsSmartPlayList() || items.IsLibraryFolder())
AddPlaylistOrder(items, LABEL_MASKS("%T", "%R", "%T", "%R")); // Title, Rating | Title, Rating


can you test/play around with that syntax template, seems to work on my end
code:

{
"order":
{
"direction":"ascending","ignorefolders":0,"method":"year"
},
"rules":
{
"or":
[
{"field":"title","operator":"startswith","value":["zur"]},
{"field":"title","operator":"contains","value":["dark"]}
]
},
"type":"movies"
}
Skins |  Titan M O D   •   S W A N (WIP)
Reply

Logout Mark Read Team Forum Stats Members Help
Sort by last played in movie library0