Permalink
Browse files

Only write M3Us and DB to disk if md5sum is different. TODO+schedule …

…updates.
  • Loading branch information...
1 parent 0668aad commit 007e177770613d39d62b5da378037996cfd9f4f9 @kingcons committed Aug 7, 2011
Showing with 26 additions and 16 deletions.
  1. +10 −10 TODO
  2. +1 −1 shuffletron.asd
  3. +15 −5 src/playlists.lisp
View
20 TODO
@@ -1,18 +1,18 @@
Features:
-Remaining features: (4) is hashing for set-playlist+2. (5) is build overhaul blocking 4.
-(6) is parse-and-execute and help cleanups. (7) is scrobbling and is blocked by 2 and 5.
+Remaining features: (5) is build overhaul. (6) is parse-and-execute and help cleanups.
+(7) is scrobbling and is blocked by 2 and 5.
(8) is having some append-only history to support "prev" track command. (9) PKGBUILD!
(10) Tests!!!
-Schedule: 2+4 should be done by evening 08/06. 5 should be done by 08/13.
-6 should be done by 08/20 and 7 by 09/01. 9 by 09/15 and 8+10 by 2012. :)
-* Playlists
--- Make get-playlist lookup case-insensitive? Insertion via set-playlist should correspond...
--- ... we ought to hash the file to prevent repeat saves of unmodified lists in set-playlist.
----- New format for *playlists* entries is: (name . (songs . hash))
------- Do we use ironclad or just md5 for this? Just md5, scrobbling doesn't need sha1, smaller.
------- We'll also need drakma for the scrobbling support, I expect. Makefiles should be overhauled and deploy tested.
+Schedule: 5 should be done by 08/13. 6 should be done by 08/20 and 7 by 09/01.
+9 by 09/15 and 8+10 by 2012. :)
+
+* UI Thoughts+Concerns
+-- Make queue load case-insensitive? save, show, etc should correspond...
-- Is there a good way to rearrange song order in the playqueue at present?
+-- Some sort of autocompletion, esp. for playlists/filepaths would be great.
+
* Last.fm/Scrobbling Support
+-- We'll need drakma for the scrobbling support. Makefiles should be overhauled and deploy tested.
-- Should cache when network connectivity is absent and scrobble later.
-- Should only scrobble songs that you listened to more than X% of. X should be a config option.
---- Skipping to the last 5% of the track (say when working on a mixtape) shouldn't trigger scrobbling.
View
2 shuffletron.asd
@@ -4,7 +4,7 @@
:version "0.0.5"
:author "Andy Hefner <ahefner@gmail.com>"
:license "MIT-style license"
- :depends-on (:mixalot :mixalot-mp3 :osicat)
+ :depends-on (:mixalot :mixalot-mp3 :osicat :md5)
:components ((:module src
:serial t
:components ((:file "packages")
View
20 src/playlists.lisp
@@ -10,6 +10,9 @@
(loop for (name . songs) in (pref "playlists.db" '())
do (set-playlist name songs)))
+(defun playlist-path (name)
+ (prefpath `("playlists" ,(format nil "~a.m3u" name))))
+
(defun get-playlist (name)
(cdr (assoc name *playlists* :test #'equal)))
@@ -24,13 +27,20 @@
(if (get-playlist name)
(setf (cdr (assoc name *playlists* :test #'equal)) songs)
(setf *playlists* (acons name songs *playlists*)))
- (playlist-to-m3u name)
- (save-playlists))
-
-(defun playlist-to-m3u (playlist &key (name playlist))
+ (let ((path (playlist-path name)))
+ (unless (and (probe-file path)
+ (equalp (md5:md5sum-file path)
+ (md5:md5sum-sequence
+ (format nil "~{~A~%~}"
+ (loop for song across (get-playlist name)
+ collecting (song-local-path song))))))
+ (playlist-to-m3u name)
+ (save-playlists))))
+
+(defun playlist-to-m3u (playlist)
"Export a playlist to m3u with the given name in ~/.shuffletron/playlists/.
If there is an existing file with the same name, it will be overwritten."
- (let ((path (prefpath `("playlists" ,(format nil "~a.m3u" name)))))
+ (let ((path (playlist-path playlist)))
(ensure-directories-exist path)
(with-open-file (out path :direction :output :if-exists :supersede)
(loop for song across (get-playlist playlist)

0 comments on commit 007e177

Please sign in to comment.