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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 1fd192fa3c2a686c5948da6ea5c719647d42725a
4
- data.tar.gz: 831a032a4b71b801395246667b78b71ce7ab7fdb
2
+ SHA256:
3
+ metadata.gz: db1b63c3551df3450ec71f7fb4c73e0fff4d569c0c8c4a390815157034c03241
4
+ data.tar.gz: 5fcec64262b151f6ea6c2a6a3585c9ef004b7913e052430dc9f5c290ddbbf966
5
5
  SHA512:
6
- metadata.gz: 0427271e71200e98d78ff23f20442ea8750468e1213ab3bafa0a3d8b723b634e603ddf3f58480aa79df59c47f3837d82ff67cab32ef8af7b4fed26be7a1f47bd
7
- data.tar.gz: a0acda4092de869b08d196f76001de6cf4489d9765c762ee608aa2ddc94ca1629e9fc34e391c50c17b22829be378c25a2f8c0b0c59186fb2aa11fbc78771d564
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
@@ -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" unless $input_file && $output_dir
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."
@@ -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.2
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: 2016-10-31 00:00:00.000000000 Z
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.5.1
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