[Release] - script.playlists
#31
ronie Wrote:cool, we're ready then ;-)

available in our repo as of now:
http://mirrors.xbmc.org/addons/eden-pre/...playlists/

Great! And many thanks. Nod
My skins:

Amber
Quartz

Reply
#32
I've been getting 'script failed' messages when trying to add them to the aeon nox skin. Posted my logs there, but was told I might get better help here as I guess this is a problem with the script. I'm basically unable to add any playlists to the menu because of this. Here's the log:
http://pastebin.com/ExvCH8Aj

Thanks for any help you can give me
Reply
#33
I'm using path substitution in advancedsettings.xml for the playlist folder location. I have a problem where when using the script to retreive the playlist (using aeon nox) it looks in the local folder instead of using path substitution location (which is a smb share on another computer)

Is it possible that the script uses the path substitution if present in advancedsettings.xml?

Thanks
Hardware: Revo 3610 + SSD - Harmony 700 Remote
Software: XBMCBuntu Gotham - Sickbeard - SabNZBd+

Image
Reply
#34
(2012-03-16, 14:29)union1mc Wrote: I've been getting 'script failed' messages when trying to add them to the aeon nox skin. Posted my logs there, but was told I might get better help here as I guess this is a problem with the script. I'm basically unable to add any playlists to the menu because of this. Here's the log:
http://pastebin.com/ExvCH8Aj

Thanks for any help you can give me

according to the error, one of your playlists contains invalid xml.
did you manually create them?
the safest way would be to use the smart playlist editor in xbmc to create playlists.
(2012-03-16, 14:38)The_Dogg Wrote: I'm using path substitution in advancedsettings.xml for the playlist folder location. I have a problem where when using the script to retreive the playlist (using aeon nox) it looks in the local folder instead of using path substitution location (which is a smb share on another computer)

Is it possible that the script uses the path substitution if present in advancedsettings.xml?

Thanks

i'm not entirely sure if xbmc also applies the pathsubstitution rules to addons.

mind testing if this rule works:
Code:
<pathsubstitution>
    <substitute>
        <from>special://profile/playlists/video/</from>
        <to>smb://computer/share/playlists/video/</to>
    </substitute>
</pathsubstitution>
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#35
(2012-03-16, 19:50)ronie Wrote:
(2012-03-16, 14:29)union1mc Wrote: I've been getting 'script failed' messages when trying to add them to the aeon nox skin. Posted my logs there, but was told I might get better help here as I guess this is a problem with the script. I'm basically unable to add any playlists to the menu because of this. Here's the log:
http://pastebin.com/ExvCH8Aj

Thanks for any help you can give me

according to the error, one of your playlists contains invalid xml.
did you manually create them?
the safest way would be to use the smart playlist editor in xbmc to create playlists.
(2012-03-16, 14:38)The_Dogg Wrote: I'm using path substitution in advancedsettings.xml for the playlist folder location. I have a problem where when using the script to retreive the playlist (using aeon nox) it looks in the local folder instead of using path substitution location (which is a smb share on another computer)

Is it possible that the script uses the path substitution if present in advancedsettings.xml?

Thanks

i'm not entirely sure if xbmc also applies the pathsubstitution rules to addons.

mind testing if this rule works:
Code:
<pathsubstitution>
    <substitute>
        <from>special://profile/playlists/video/</from>
        <to>smb://computer/share/playlists/video/</to>
    </substitute>
</pathsubstitution>

Thanks Ronie, that was the problem. I usually make my own, since I have the system down,but there was 1 bad one in there that I had been experimenting with. The other 25 were good.
Reply
#36
I'm encountering the same problem as The_Dogg. My advancedsettings.xml contains:
Code:
<substitute>
    <from>special://masterprofile/playlists/</from>
    <to>smb://192.168.0.100/xbmc/userdata/playlists/</to>
</substitute>
I, too, am using Aeon Nox, and when the script is called it looks at the local folder, instead of the share. Here is the relevant part of my log (suitably anonymized):
Code:
00:19:56 T:7096   DEBUG: Thread XBPyThread start, auto delete: 0
00:19:56 T:7096   DEBUG: Python thread: start processing
00:19:56 T:7096  NOTICE: -->Python Interpreter Initialized<--
00:19:56 T:7096   DEBUG: XBPyThread::Process - The source file to load is C:\Users\<username>\AppData\Roaming\XBMC\addons\script.playlists\default.py
00:19:56 T:7096   DEBUG: XBPyThread::Process - Setting the Python path to C:\Users\<username>\AppData\Roaming\XBMC\addons\script.playlists;C:\Program Files (x86)\XBMC\addons\script.module.simplejson\lib;C:\Users\<username>\AppData\Roaming\XBMC\addons\script.module.beautifulsoup\lib;C:\Program Files (x86)\XBMC\addons\script.module.pil\lib;C:\Users\<username>\AppData\Roaming\XBMC\addons\script.module.elementtree\lib;C:\Program Files (x86)\XBMC\addons\script.module.pysqlite\lib;C:\Program Files (x86)\XBMC\system\python\DLLs;C:\Program Files (x86)\XBMC\system\python\Lib;C:\Program Files (x86)\XBMC\python26.zip;C:\Program Files (x86)\XBMC\system\python\lib\plat-win;C:\Program Files (x86)\XBMC\system\python\lib\lib-tk;C:\Program Files (x86)\XBMC;C:\Program Files (x86)\XBMC\system\python;C:\Program Files (x86)\XBMC\system\python\lib\site-packages;
00:19:56 T:7096   DEBUG: XBPyThread::Process - Entering source directory C:\Users\<username>\AppData\Roaming\XBMC\addons\script.playlists
00:19:56 T:7096   DEBUG: Instantiating addon using automatically obtained id of "script.playlists" dependent on version 2.0 of the xbmc.python api
00:19:56 T:7096   DEBUG: script.playlists: script version 0.1.0 started
00:19:56 T:7096   DEBUG: script.playlists: params: {'type': 'video'}
00:19:56 T:7096    INFO: -->Python script returned the following error<--
00:19:56 T:7096   ERROR: Error Type: <type 'exceptions.WindowsError'>
00:19:56 T:7096   ERROR: Error Contents: (3, 'The system cannot find the path specified', 'C:\\Users\\<username>\\AppData\\Roaming\\XBMC\\userdata\\playlists\\video\\*.*')
00:19:56 T:7096   ERROR: Traceback (most recent call last):
                                              File "C:\Users\<username>\AppData\Roaming\XBMC\addons\script.playlists\default.py", line 71, in <module>
                                                Main()
                                              File "C:\Users\<username>\AppData\Roaming\XBMC\addons\script.playlists\default.py", line 18, in __init__
                                                self._fetch_playlists()
                                              File "C:\Users\<username>\AppData\Roaming\XBMC\addons\script.playlists\default.py", line 45, in _fetch_playlists
                                                dirlist = os.listdir( xbmc.translatePath( path ) )
                                            WindowsError: (3, 'The system cannot find the path specified', 'C:\\Users\\<username>\\AppData\\Roaming\\XBMC\\userdata\\playlists\\video\\*.*')
00:19:56 T:7096    INFO: -->End of Python script error report<--
00:19:56 T:7096    INFO: Python script stopped
00:19:56 T:7096   DEBUG: Thread XBPyThread 7096 terminating
I altered my advancedsettings.xml to include:
Code:
<substitute>
    <from>special://masterprofile/playlists/</from>
    <to>smb://192.168.0.100/xbmc/userdata/playlists/</to>
</substitute>
<substitute>
    <from>special://profile/playlists/</from>
    <to>smb://192.168.0.100/xbmc/userdata/playlists/</to>
</substitute>
and the same error occurred. I also tried:
Code:
<substitute>
    <from>special://masterprofile/playlists/</from>
    <to>smb://192.168.0.100/xbmc/userdata/playlists/</to>
</substitute>
<substitute>
    <from>special://profile/playlists/video/</from>
    <to>smb://192.168.0.100/xbmc/userdata/playlists/video/</to>
</substitute>
to no avail. As a last ditch attempt I tried:
Code:
<substitute>
    <from>special://profile/playlists/video/</from>
    <to>smb://192.168.0.100/xbmc/userdata/playlists/video/</to>
</substitute>
(no masterprofile substitution). That stopped the error in the log, but only because it caused the playlist folder to be created locally (which was, of course, empty). The script still did not follow the substitution.
Reply
#37
as far as i can tell, xbmc does not apply the path substitution rules to special:// paths used in addons.

i can't think of any way fixing this in the script.

edit:
i'll push an update to make sure the script at least doesn't crash when pathsubstitution is used.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#38
Thanks! Should a bug report or feature request be filed to resolve this?

[edit]
One workaround would be for the script to look at advancedsettings.xml and perform the substitutions itself. I'm not familliar with python, but I'll try to take a look at the script later today.
[/edit]
Reply
#39
(2012-03-24, 18:21)kaburke Wrote: One workaround would be for the script to look at advancedsettings.xml and perform the substitutions itself. I'm not familliar with python, but I'll try to take a look at the script later today.

even if path substitution would work, the script will most probably fail on the next step,
ie. listing the contents of the directory.

afaik there's no way to do this from python on smb shares.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#40
(2012-03-24, 18:37)ronie Wrote:
(2012-03-24, 18:21)kaburke Wrote: One workaround would be for the script to look at advancedsettings.xml and perform the substitutions itself. I'm not familliar with python, but I'll try to take a look at the script later today.

even if path substitution would work, the script will most probably fail on the next step,
ie. listing the contents of the directory.

afaik there's no way to do this from python on smb shares.

I wrote a couple of little functions for my mmabrowser addon which work as sort of a replacement for os.walk and support (afaik) any local or remote share type that xbmc understands.

Maybe they'd be useful for you in this case?

Code:
def getDirList(path):
    dirList = []
    currentLevelDirList = [path]
    while True:
        prevLevelDirList = []
        if len(currentLevelDirList) > 0:
            for dirName in currentLevelDirList:
                prevLevelDirList.append(dirName)
                dirList.append(dirName)
            currentLevelDirList = []
        else:
            break
        for dirName in prevLevelDirList:
            log('Checking for directories in: %s' % dirName)
            json_response = xbmc.executeJSONRPC('{ "jsonrpc" : "2.0" , "method" : "Files.GetDirectory" , "params" : { "directory" : "%s" , "sort" : { "method" : "file" } } , "id" : 1 }' % dirName.encode('utf-8').replace('\\', '\\\\'))
            jsonobject = simplejson.loads(json_response)
            if jsonobject['result']['files']:
                for item in jsonobject['result']['files']:
                    if item['filetype'] == 'directory':
                        currentLevelDirList.append(item['file'])
    return dirList


def getFileList(path):
    fileList = []
    dirList = getDirList(path)
    for dirName in dirList:
        log('Checking for files in: %s' % dirName)
        json_response = xbmc.executeJSONRPC('{ "jsonrpc" : "2.0" , "method" : "Files.GetDirectory" , "params" : { "directory" : "%s" , "sort" : { "method" : "file" } , "media" : "video" } , "id" : 1 }' % dirName.encode('utf-8').replace('\\', '\\\\'))
        jsonobject = simplejson.loads(json_response)
        if jsonobject['result']['files']:
            for item in jsonobject['result']['files']:
                if item['filetype'] == 'file':
                    fileList.append(item['file'])
                    log('Found video: %s' % item['file'])
    return fileList
Reply
#41
(2012-03-28, 20:22)paddycarey Wrote:
(2012-03-24, 18:37)ronie Wrote:
(2012-03-24, 18:21)kaburke Wrote: One workaround would be for the script to look at advancedsettings.xml and perform the substitutions itself. I'm not familliar with python, but I'll try to take a look at the script later today.

even if path substitution would work, the script will most probably fail on the next step,
ie. listing the contents of the directory.

afaik there's no way to do this from python on smb shares.

I wrote a couple of little functions for my mmabrowser addon which work as sort of a replacement for os.walk and support (afaik) any local or remote share type that xbmc understands.

Maybe they'd be useful for you in this case?
nice, it never crossed my mind to use json for listing dirs.

thanx for the code example :-)
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#42
fixed a bug that could cause the script to crash when special characters are used in the playlist filename.

please test and let me know if this:
- fixes it
- doesn't break anything else

script.playlists-1.0.2.zip

Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#43
Work fine for me with smart playlist named Animés and filename Animés.xsp.

Tested on Windows XP SP3.

Thanks Ronie.
Sorry for my english, but, you know, I'm French so ...

Main HTPC : Odroid-C2 running CoreELEC with Titan Bingie
Secondary HTPC : Freebox Mini 4K running Android TV with Titan Bingie
Reply
#44
(2013-02-11, 18:38)mikebzh44 Wrote: Work fine for me with smart playlist named Animés and filename Animés.xsp.

Tested on Windows XP SP3.

Thanks Ronie.

cheers for the feedback mate!
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#45
Would someone please tell me what I'm doing wrong:

I'm using Frodo with Aeon Nox v4. Created a custom Music submenu item with a Type of "Custom" and then entered the following code, but nothing happens.

Code:
RunScript(script.playlists,type=music)
HTPC: Dell Optiplex 7050 SFF i7-7700 quad-core, 3.6GHz, 16GB
NAS: Synology DS1813+ and DX513, Hybrid RAID (SHR) 48TB usable space
My Media Center | www.CaptainKen.us | www.YouTube.com/KenInGilbert
Reply

Logout Mark Read Team Forum Stats Members Help
[Release] - script.playlists0