Hello,
I have a Vero 4K with OSMC running smootly, no additional add-ons.
I want to have playlists according to path of the files
following this documentation: https://kodi.wiki/view/Smart_playlists
I have a smart playlist file
.kodi/userdata/playlists/video/kids_movies.xsp
it contains:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
<name>Films kids</name>
<rule field="path" operator="contains">
<value>kids</value>
</rule>
<order direction="descending">title</order>
</smartplaylist>
the playlist returns no results
I notice in the debug log the following query being executed:
14:13:16.431 T:3328537344 DEBUG: RunQuery took 3 ms for 0 items query: select * from movie_view WHERE ((movie_view.strPath LIKE '
'))
I also tried with operations ‘contains’ or ‘is’ , there’s no result.
It looks like the query is not correct.
I also manually queried with sqlite, the path information is correct in the database:
sqlite3 .kodi/userdata/Database/MyVideos107.db 'select strPath from movie_view'
/media/My Book/media/kids movies/
/media/My Book/media/kids movies/
/media/My Book/media/kids movies/
/media/My Book/media/kids movies/
/media/My Book/media/kids movies/
/media/My Book/media/kids movies/
...
Anyone knows how comes the query is wrong? Is there wrong syntax?
We believe this is a Kodi issue or a specific Kodi function and as such you should look at addressing the issue there. We are unable to resolve your issue. If you do believe that this is an OSMC specific issue, please let us know.
try it with
<rule field="path" operator="startswith">
<value>kids</value>
</rule>
I’ve never used a smart playlist but I took the time to read the page you linked to. Section 3.2 starts:
Basically there are two header tags, <name> and <match>
I don’t know if it has a default value, but you have omitted the <match> tag. (All examples on that page contain the <match> tag.)
On a more general note, please post the full log if you want us to be able to help you. Small snippets provide too little information.
This example worked here for some time - I only changed the value for “kids”
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
<name>Film Kids</name>
<match>one</match>
<rule field="path" operator="startswith">
<value>kids</value>
</rule>
<order direction="descending">title</order>
</smartplaylist>
Are you sure you want the titles in descending order? If you want the newest additions at the top of the list use <order direction="descending">dateadded</order>
Thanks!
I’ve tried, no results, this is the kodi.log:
16:38:38.227 T:3555746560 DEBUG: CWebServer[80]: request received for /jsonrpc?Base
16:38:38.239 T:3508835072 DEBUG: CWebServer[80]: request received for /jsonrpc?Addons.GetAddons
16:38:38.283 T:3539002112 DEBUG: CWebServer[80]: request received for /jsonrpc?PlaylistCollection
16:38:38.296 T:3555746560 DEBUG: CWebServer[80]: request received for /jsonrpc?Application.GetProperties
16:38:38.380 T:3555746560 DEBUG: CWebServer[80]: request received for /jsonrpc?Player.GetActivePlayers
16:38:38.402 T:3555746560 DEBUG: CWebServer[80]: request received for /jsonrpc?PlaylistCollection
16:38:38.432 T:3564135168 DEBUG: CWebServer[80]: request received for /jsonrpc?Application.GetProperties
16:38:38.452 T:3564135168 DEBUG: CWebServer[80]: request received for /jsonrpc?Player.GetActivePlayers
16:38:40.988 T:3564135168 DEBUG: CWebServer[80]: request received for /jsonrpc?FileCollection
16:38:42.753 T:3564135168 DEBUG: Previous line repeats 1 times.
16:38:42.753 T:3564135168 DEBUG: RunQuery took 4 ms for 0 items query: select * from movie_view WHERE ((movie_view.strPath LIKE 'kids%'))
16:38:48.440 T:3564135168 DEBUG: CWebServer[80]: request received for /jsonrpc?JSONRPC.Ping
16:38:48.452 T:3564135168 DEBUG: CWebServer[80]: request received for /jsonrpc?Application.GetProperties
16:38:48.461 T:3564135168 DEBUG: CWebServer[80]: request received for /jsonrpc?Player.GetActivePlayers
16:38:56.852 T:3883811584 DEBUG: script.module.osmcsetting.updates : - blurp 536 - /usr/share/kodi/addons/service.osmc.settings/resources/skins/Default/1080i/settings_gui.xml
But as suggested, I will seek help in Kodi Forum. Thanks!
I’m sure you’ll find better help there. I just saw, that your path does not start with “kids”. This could be worth one more try
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
<name>Film Kids</name>
<match>all</match>
<rule field="path" operator="startswith">
<value>/media/My Book/media/kids movies/</value>
</rule>
<order direction="descending">title</order>
</smartplaylist>
Did you add the <match> tag?
Your SQL query isn’t going to work becaase your path doesn’t start with “kids”.
select * from movie_view WHERE ((movie_view.strPath LIKE 'kids%'))
Your previous SQL query was
select * from movie_view WHERE ((movie_view.strPath LIKE ' '))
which isn’t going to find anything.
Did you try using contains with the <match> tag?
16:17:57.769 T:1925647552 DEBUG: RunQuery took 12 ms for 0 items query: select * from movie_view WHERE ((movie_view.strPath LIKE '%kids%'))
Works fine.
osmc@osmc-pi3:~$ cat .kodi/userdata/playlists/video/kids.xsp
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="movies">
<name>kids</name>
<match>all</match>
<rule field="path" operator="contains">
<value>kids</value>
</rule>
</smartplaylist>
Hello! It works!
I see following query in the log:
17:45:33.638 T:3500446464 DEBUG: RunQuery took 8 ms for 69 items query: select * from movie_view WHERE ((movie_view.strPath LIKE '%kids%'))
Learning? Don’t forget the <match>
clause
Something else?
Thank you to keep trying!