Skip to content

Commit

Permalink
fix on add_dir
Browse files Browse the repository at this point in the history
  • Loading branch information
fcostantini committed Oct 3, 2016
1 parent 546f359 commit bc903a3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion PlEb.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: PlEb
version: 1.2.0
version: 1.2.0.1
synopsis: A simple tool to edit and export playlists
license: GPL-3
license-file: LICENSE
Expand Down
29 changes: 16 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ A simple tool to manage playlists. Supported formats are m3u, m3u8, pls, wpl and

## Requirements

A modern version of stack. For Windows, Haskell Platform has everything you need. Alternatively an executable is available in Releases.
A modern version of stack. For Windows, Haskell Platform has everything you need. Alternatively an executable is available [here](https://github.com/fcostantini/PlEb/releases).

## Installation

Expand All @@ -22,15 +22,18 @@ To load a playlist:

### Operations

**Note:** add and rmv actually modify the file, you may want to do a backup before.

add: adds a song to the playlist.
add_dir: adds a directory to the playlist.
check: checks if the songs actually exist.
combine: combines playlists.
convert: converts the playlist to another format.
export: copies every (correct) song to a single folder.
load: loads another playlist.
print: shows contents of the playlist.
rmv: removes a song from the playlist.
exit/quit: exits the program.
- add: adds a song to the playlist.
- add_dir: adds a directory to the playlist.
- check: checks if the songs actually exist.
- combine: combines playlists.
- convert: converts the playlist to another format.
- export: copies every (correct) song to a single folder.
- load: loads another playlist.
- print: shows contents of the playlist.
- rmv: removes a song from the playlist.
- exit/quit: exits the program.

**Notes:**

- add, add_dir and rmv actually modify the file, you may want to do a backup before.
- when adding songs, if the given path is relative it will be added with that path. If you want to add with absolute paths you must provide them explicitely.
5 changes: 4 additions & 1 deletion src/Operations.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ import Misc
import Playlist
import Report

--should paths be absolute?

getPlaylist :: F.FilePath -> IO Playlist
getPlaylist file = let ext = getExt file
in if ext == Other then putStrLn ("Unsupported format.") >> exitSuccess
Expand Down Expand Up @@ -47,7 +49,8 @@ addDir d pl = do exists <- doesDirectoryExist d
putStrLn ("\nadd_dir error: directory " ++ d ++ " does not exist.\n") >> return pl
else do putStrLn ("\nAdding songs in " ++ d ++ " to playlist... \n")
contents <- listDirectory d
(newpl, r) <- runStateT (foldM addSong' pl contents) iReport
let paths = map (\x -> d ++ "/" ++ x) contents
(newpl, r) <- runStateT (foldM addSong' pl paths) iReport
putStrLn $ ppReport r
return newpl

Expand Down

0 comments on commit bc903a3

Please sign in to comment.