playlist_transfer 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +2 -0
- data/bin/playlist_transfer +6 -2
- data/lib/playlist_transfer.rb +10 -3
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: db1b63c3551df3450ec71f7fb4c73e0fff4d569c0c8c4a390815157034c03241
|
4
|
+
data.tar.gz: 5fcec64262b151f6ea6c2a6a3585c9ef004b7913e052430dc9f5c290ddbbf966
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 32c81bd1b72cdf7e5f4f1bb2e2f5c70d53980540266724ebfff0a1cf1816e0b4cb1e12bb71293ef20742f65bfb8468bf8c1e04aa4bc115fdf8ce249ae19e467b
|
7
|
+
data.tar.gz: d56be9eb2e63a0b8dddfe54e9a7c760898d05a872a73b5caf4b9245d8e14a8b8acbb2905703d4037516fa12fd42eda08e9095433954ba50f65eeb022446a402b
|
data/README.md
CHANGED
@@ -42,6 +42,8 @@ Script has these options:
|
|
42
42
|
|
43
43
|
**--justcopy** - do not convert FLAC files to MP3
|
44
44
|
|
45
|
+
**--skoda** - create M3U playlist in the root of output directory for Skoda Swing audio system compatibility. Might work for other Skoda audio systems, but tested only with Swing. This is for beeing able to shuffle all music on flashdrive. This option also automatically enables --compatible flag, because that's what Skoda audio needs.
|
46
|
+
|
45
47
|
## Requirements
|
46
48
|
* flac binary installed
|
47
49
|
* lame binary installed
|
data/bin/playlist_transfer
CHANGED
@@ -21,6 +21,9 @@ ARGV.each do |argument|
|
|
21
21
|
$compatible = true
|
22
22
|
when /--justcopy/
|
23
23
|
$justcopy = true
|
24
|
+
when /--skoda/
|
25
|
+
$skoda = true
|
26
|
+
$compatible = true
|
24
27
|
else
|
25
28
|
puts "Invalid argument #{argument}"
|
26
29
|
end
|
@@ -30,7 +33,8 @@ abort "Bad syntax.\nUsage: #{File.basename($0)} if=INPUT_FILE out=OUTPUT_DIR [ba
|
|
30
33
|
|
31
34
|
Available options:
|
32
35
|
--compatible = transfer filenames and directory names without special characters
|
33
|
-
--justcopy = do not convert FLAC files to MP3
|
36
|
+
--justcopy = do not convert FLAC files to MP3
|
37
|
+
--skoda = create M3U playlist in target root directory compatible with Skoda Swing car audio. This flag also automatically enables --compatible." unless $input_file && $output_dir
|
34
38
|
abort "Cannot read file #{$input_file.to_s} . Does it exist?" unless $input_file.expand_path.file? && $input_file.expand_path.readable?
|
35
39
|
|
36
40
|
# If basedir is not defined by input, set basedir to directory where playlist is located
|
@@ -48,6 +52,6 @@ playlist = M3u8::Playlist.read(playlist_file)
|
|
48
52
|
playlist.items.each do |item|
|
49
53
|
track_location = Pathname.new(item.segment)
|
50
54
|
track=MusicTrack.new(track_location,$base_dir)
|
51
|
-
track.transfer($output_dir, $compatible, $justcopy)
|
55
|
+
track.transfer($output_dir, $compatible, $justcopy, $skoda)
|
52
56
|
end
|
53
57
|
puts "Transfer complete."
|
data/lib/playlist_transfer.rb
CHANGED
@@ -85,7 +85,7 @@ class MusicTrack
|
|
85
85
|
# This method transfers track file to destination (outfile parameter is Pathname). (When it is FLAC, it converts it to MP3 by default, other files will be just copied).
|
86
86
|
# You can specify that you do not want to convert FLAC to MP3 by adding second parameter (justcopy) with value "true".
|
87
87
|
# It also creates directory structure (relatively from basedir to track itself) in destination.
|
88
|
-
def filetransfer(outfile, justcopy = nil)
|
88
|
+
def filetransfer(outfile, justcopy = nil, skoda = nil, relative_path = nil, output = nil)
|
89
89
|
abort "File #{@path.to_s} does not exist." if !@path.file?
|
90
90
|
outfile = outfile.sub(/\.flac$/i, '.mp3') if !justcopy
|
91
91
|
# If file in destination already exists in destination, skip it, no need to tranfer it.
|
@@ -97,6 +97,13 @@ class MusicTrack
|
|
97
97
|
else
|
98
98
|
FileUtils.cp(@path.realpath,outfile)
|
99
99
|
end
|
100
|
+
# Quick and dirty fix for stuid SKODA audio system, to be able to shuffle all music on storage (Not just in folder like it usualy does)
|
101
|
+
if skoda
|
102
|
+
playlist_line = "/" + relative_path.to_s
|
103
|
+
open("#{output}/ALL_MUSIC.M3U", 'a') { |f|
|
104
|
+
f.puts playlist_line
|
105
|
+
}
|
106
|
+
end
|
100
107
|
else
|
101
108
|
puts "File #{outfile.to_s} already exists. Skipping..."
|
102
109
|
end
|
@@ -105,7 +112,7 @@ class MusicTrack
|
|
105
112
|
# Method to transfer file and it's directory structure to destination (output)
|
106
113
|
# You can specify you want to create directory srtucture in destination in "compatible" way. This means no spaces and special characters in filenames.
|
107
114
|
# If you do not want any conversion from FLAC to MP3, just set justcopy to true.
|
108
|
-
def transfer(output, compatible = nil, justcopy = nil)
|
115
|
+
def transfer(output, compatible = nil, justcopy = nil, skoda = nil)
|
109
116
|
abort "Can't write to #{output.to_s} or it is not directory." unless output.expand_path.directory? && output.expand_path.writable?
|
110
117
|
|
111
118
|
# Next 3 lines just creates complete destination path for transfered track (combining desired output directory, current track location, and basedir). It also removes special characters if necessary.
|
@@ -113,7 +120,7 @@ class MusicTrack
|
|
113
120
|
relative_path = relative_path.no_special_chars if compatible
|
114
121
|
output_file = output.expand_path + relative_path
|
115
122
|
|
116
|
-
self.filetransfer(output_file, justcopy)
|
123
|
+
self.filetransfer(output_file, justcopy, skoda, relative_path, output.expand_path)
|
117
124
|
end
|
118
125
|
|
119
126
|
# Method to transfer file and it's structure in "compatible" way (file and it's directory structure with removed special characters) - just alias for transfer with proper parameters.
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: playlist_transfer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kisuke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: m3u8
|
@@ -71,7 +71,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
71
71
|
version: '0'
|
72
72
|
requirements: []
|
73
73
|
rubyforge_project:
|
74
|
-
rubygems_version: 2.
|
74
|
+
rubygems_version: 2.7.6
|
75
75
|
signing_key:
|
76
76
|
specification_version: 4
|
77
77
|
summary: Transfers music (defined by M3U playlist) from your music library to destination
|