[Release] - script.playlists

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
pecinko Offline
Donor
Posts: 3,015
Joined: Dec 2008
Reputation: 27
Location: Prague / Belgrade
Post: #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:

Quartz
Amber
find quote
union1mc Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 1
Post: #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
find quote
The_Dogg Offline
Fan
Posts: 375
Joined: Feb 2004
Reputation: 3
Location: Canada
Post: #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 Frodo - Sickbeard - SabNZBd+

[Image: all-clearlogo.jpg]
(This post was last modified: 2012-03-16 14:39 by The_Dogg.)
find quote
ronie Offline
Team-XBMC Member
Posts: 8,254
Joined: Jan 2009
Reputation: 108
Post: #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>

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not PM or 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.
(This post was last modified: 2012-03-16 20:02 by ronie.)
find quote
union1mc Offline
Junior Member
Posts: 22
Joined: Jan 2012
Reputation: 1
Post: #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.
find quote
kaburke Offline
Junior Member
Posts: 18
Joined: Mar 2012
Reputation: 0
Post: #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.
find quote
ronie Offline
Team-XBMC Member
Posts: 8,254
Joined: Jan 2009
Reputation: 108
Post: #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.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not PM or 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.
(This post was last modified: 2012-03-24 16:14 by ronie.)
find quote
kaburke Offline
Junior Member
Posts: 18
Joined: Mar 2012
Reputation: 0
Post: #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]
(This post was last modified: 2012-03-24 18:23 by kaburke.)
find quote
ronie Offline
Team-XBMC Member
Posts: 8,254
Joined: Jan 2009
Reputation: 108
Post: #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.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not PM or 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.
find quote
paddycarey Offline
Senior Member
Posts: 246
Joined: Sep 2009
Reputation: 8
Post: #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
find quote