Kodi Community Forum
Playlistwalker (a playlist generator script) - 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: Playlistwalker (a playlist generator script) (/showthread.php?tid=10040)

Pages: 1 2

- thor918 - 2005-02-16

it walks trough folders on harddrive or a network share,
while it walks it generates a 'playlistwalker.m3u' file in each folder.
the playlist that is generated can consist of 'mp3','avi','jpg' or whatever.

hope this script will get more comments than my first script.


- pike - 2005-02-17

nothing i need but new scripts are always appreciated.

sounds more like it "crawls" than "walks" Confusedaint:

- thor918 - 2005-02-17

your right, it looks like a crawler Wink
the name is picked because of the phyton command for going trough folders and files  = os.walk
very logic  :p

to use the script you will have to copy lib files and extract them to the phyton lib directory on xbmc.
then extract the playlistwalker.py to scripts directory on xbmx.
after this you will have to add walk commands at the bottom of the playlistwalker.py script.

the command looks like this
if you want to crawl the harddrive of the xbox :

if you want to crawl a network share:
walkthesmb('share\\folder\\','computername', '' , 'username' ,'password',['mp3','avi','jpg','mpg','mov'])

and remember to enable write premissions on the share.

you look at the share crawl command and say, is it really nesseasary to have both computername and ipadress.
then i say yes!
:p (the sharelib requier both values.don't ask me why)

- deemeph - 2005-02-18

great script i have been looking for something like this. thanks!

- thor918 - 2005-02-22

i'm glad at least one found it usefull Wink

- deemeph - 2005-02-28

okay this is great, but i have 2 comments, one would it be possible to name the playlist the same as the folder? and also i have a folder.jpg in each of my music folders (and some video but i use this script for music only) and i get the folder.jpg in each playlist not a big deal but if you could put something in to ignore these, also <filename>.tbn

other then that this is perfect, did about 500 music album folders in 2mins with no problems.

thanks again!

- thor918 - 2005-02-28

hi again.
name the playlist the same as the folder. yes

> ignore these, also <filename>.tbn
but it sholdn't add tbn files unless it is specified
(will add files with mp3,avi,jpg,mpg,mov but nothing else.)

i will checkit out. be right back

- thor918 - 2005-02-28

i added a new version now:

* discard folder.jpg
* added foldername in progressdialog
* added a variable to choose from [foldername].m3u or playlistwalker.m3u
 (if we are walking in the root the playlist will be playlistwalker.m3u always)

- EvilGoodGuy - 2005-03-04

first off great script. but i was wondering if you would help me with a few slight modifications. i'm not to good with advanced python so i can't do it myself.

1.) i would like to save the playlists named as the folder they were originated in in the designated playlist area so that a randomplaylist chooser can pick them out easily. i just didn't know where exactly in the write command the destination folder was. :p

2.) i have all of my music in a f:/mp3/artist/album format. could you possibly alter your code for me so that it will walk into each artist folder forming only one playlist containing all albums? i tried doing this myself, but ran into problems where it would just be overwritting the previous foler's playlist instead of adding to it.

if you could do this that would be wonderful, if not then no problem at all. thanks for the script so far, and i hope you have time for this modification :bowdown:

- Tomkun - 2005-03-04

i can't get this to work with my smb shares... what could i be doing wrong? can someone give me an example of how to edit the script properly? perhaps i did it wrong...

- thor918 - 2005-03-04

if i logon ip has the computer name "thorsdata") by my windows pc:
i will see these folders

so i want to playlist genereate f

this works for me :
walkthesmb('f\\','thorsdata', '' , 'administrator' ,'password',['mp3','avi','jpg','mpg','mov'])

the only down thing is that for a unknown reason the share lib by "michael teo " will only return (max 30 files and folders ) for each folder prossessed.

i will see if i can add something for you.
be right back.

- Tomkun - 2005-03-04

thanks thor, it works a treat now. i was missing a colon after my user name. d'oh!

- thor918 - 2005-03-05

new version:

command looks like this now
cleanthehd(['e:\\music']) #removes all playlist it findes in it's path Wink

#          walkdirectory,storebigplaylistdirectory
this coomand will crawl trough the walkdirectory, and add all to a big file.the playlist will be named after the walkdirectory folder.so there is a chance for overwriting, but this can be avoided by different startfolder(from walkdirectory) names.

(perhaps i will change the storebiglistdirectory to a path and filename. that way it will be easier to store lists without the chance for overwriting existing playlist in that folder.let me know what you think)

#                walkdirectory

#walkthesmb(['f\\musikk\\'],'computername', '' , 'username ,'password',['mp3','avi','jpg','mpg','mov'])

good to hear that you got it working  :d

- thor918 - 2005-03-05

if there is any other tips or addons
for what you would like to see in this script i will do my best to add it Wink

perhaps there will be a gui for it someday.

- thor918 - 2005-03-05

a small little test to show that the lib for smb will only return about 30 files and folders each time it is called.

import os, sys, string, socket
import smb, nmb

netbios = nmb.netbios()
print 'connecting to share.............'

remote = smb.smb('computername' , '' )
remote.login('administrator', 'password')

#list = remote.list_path('share','folder\\/*.*')
list = remote.list_path('c','musikk\\/*.*')
print "total files found " + str(len(list))

this has the same result on query of a smb share running on a win2000,winxp.
i did the test from xbox and win2000. same results.

the folder musikk has 50 files, and the smblib will return a total of 32 files. perhaps somebody else can nag the author about it.