diff options
author | Jon Bergli Heier <snakebite@jvnv.net> | 2011-08-13 16:23:34 +0200 |
---|---|---|
committer | Jon Bergli Heier <snakebite@jvnv.net> | 2011-08-13 16:23:34 +0200 |
commit | 4722c4cfceb2a2dbf9c1b7bcd1aa38925c6a1a60 (patch) | |
tree | 164cdab141be8a9f56c74f3e98d4eb2c1d8d557d | |
parent | 3f28503102c9c1912885b565a7d90de358f43d83 (diff) |
Add all files to queue.
-rw-r--r-- | directory.py | 2 | ||||
-rw-r--r-- | static/index.html | 1 | ||||
-rw-r--r-- | static/player.js | 13 | ||||
-rw-r--r-- | static/style.css | 1 |
4 files changed, 16 insertions, 1 deletions
diff --git a/directory.py b/directory.py index 6b8eaaf..5a0c318 100644 --- a/directory.py +++ b/directory.py @@ -101,7 +101,7 @@ class File(DirectoryEntry): cache_path_dir = os.path.dirname(cache_path) # check and create cache directory if not os.path.exists(cache_path_dir): - os.mkdir(cache_path_dir) + os.makedirs(cache_path_dir) # check if file is cached if not os.path.exists(cache_path): events.event_pub.recoding(self.path) diff --git a/static/index.html b/static/index.html index 23e2db6..6f24aba 100644 --- a/static/index.html +++ b/static/index.html @@ -18,6 +18,7 @@ <div id="hpanel"> <span> <span class="list-header">Browse directory</span> + <a href="#" onclick="add_directory(); return false" id="add-dir">Add all</a> <ul id="song-links"></ul> </span> <span> diff --git a/static/player.js b/static/player.js index d10080b..ab583ee 100644 --- a/static/player.js +++ b/static/player.js @@ -18,6 +18,7 @@ function MusicListing(type, path, name, cached) { this.name = name ? name : path.split('/').pop(); this.a = document.createElement('a'); this.a.tag = path; + this.a.ml = this; this.play = function() { log('playing ' + path); @@ -117,6 +118,18 @@ function list(root) { xmlhttp.send(); } +function add_directory() { + var songs = document.getElementById('song-links').getElementsByTagName('a'); + for(var i = 0; i < songs.length; i++) { + var a = songs[i]; + log(a); + var ml = a.ml; + log(ml); + if(ml.type && ml.type == 'file') + playlist.add(ml); + } +} + var source = null; function get_a(path) { diff --git a/static/style.css b/static/style.css index 25bcc4b..35319c0 100644 --- a/static/style.css +++ b/static/style.css @@ -13,3 +13,4 @@ div#hpanel span ul { list-style-type: none; padding-left: 0; margin-top: .5em; v ul#playlist li a.playing { background-image: url('/static/icons/sound.png'); } span.list-header { font-size: large; } ul#song-links { width: 30em; overflow: auto; white-space: nowrap; resize: both; } +a#add-dir { font-size: small; } |