unitf-radio 0.2.1 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a9aa5798a180cde436ad335372abbd5a107a9fed66fa8551df039bc7c907619
4
- data.tar.gz: 170941677f0c80747c0ca11499a641effcfebd4f58500ccf5c8ea2f07e11e904
3
+ metadata.gz: 11374a666a85ba438f2f27c5fc9c2411e6f6aeedd67f43740089426c344a7f14
4
+ data.tar.gz: 83098d158c8130fad15e27d8469918efa81db9acb38302bf74aaa6083eff3d0a
5
5
  SHA512:
6
- metadata.gz: 0dd5c6660cd9e642739ca0e00a9a854f122dcea0b1aaec82879d35a8fb0904066b6dee068ff1629bd6d1991841056bb414362c1a1ac7c570b9b3769b4d3e2179
7
- data.tar.gz: fd0045a4a288bfdf733f7d489daba5154c3d5f26da35c4fc406d96a33946788a703c40222f0a11b65582195e4c1c32b7213779e5c660606589b21fdc555e0a24
6
+ metadata.gz: e24e7f44309effb55418ab412cd41a2c1832f5fbb501441cd9d8390f22268d0a65444254876ffe512f3f872efbb8aaa0a31a5261ebd9c0f8bd1322b25ff6149d
7
+ data.tar.gz: d53b8af607fa582e22eb7c6a62f91c1a4ac301166be1d140ec6b3bd74074c4515b0a9ca5016e9b0ea0172b338251c60a9fdcd251e6bc5aea6a63b738b18b1f13
data/.vscode/tasks.json CHANGED
@@ -14,9 +14,9 @@
14
14
  "cwd": "${workspaceFolder}",
15
15
  },
16
16
  "presentation": {
17
- "clear": false
17
+ "clear": true
18
18
  },
19
- "command": "bundle exec ruby exe/wfmu -d /Users/mbaron/tmp/radio BJ"
19
+ "command": "bundle exec ruby exe/wfmu -d /Users/mbaron/music2 BJ"
20
20
  },
21
21
  {
22
22
  "label": "test-project",
@@ -49,4 +49,4 @@
49
49
  "problemMatcher": []
50
50
  }
51
51
  ]
52
- }
52
+ }
data/bin/test.rb CHANGED
@@ -3,4 +3,12 @@
3
3
  require 'unitf/radio'
4
4
  require 'unitf/radio/wfmu'
5
5
 
6
- UnitF::Radio::WFMU.show_data('BJ')
6
+ # show_id, title, url, date, target_dir
7
+
8
+ UnitF::Radio::WFMU.process_episode(
9
+ 'BJ',
10
+ 'My Title',
11
+ 'http://www.wfmu.org/listen.m3u?archive=267103&show=149648',
12
+ Date.parse('Wed, 05 Nov 2008 12:05:24 -0500'),
13
+ '/Users/mbaron/radio'
14
+ )
data/exe/kfai CHANGED
@@ -53,7 +53,6 @@ shows = {
53
53
  shows.each_pair do |key, show|
54
54
  dates = show_dates(show[:day])
55
55
  show_dir = "#{BASE_DIR}/#{show[:name]}"
56
- playlist_file = "#{show_dir}/#{show[:name]}.m3u"
57
56
 
58
57
  dates.each do |date|
59
58
  target_dir = "#{show_dir}/#{date.year}"
@@ -75,19 +74,18 @@ shows.each_pair do |key, show|
75
74
  end
76
75
 
77
76
  UnitF::Tag.update(target_path) do |file|
78
- file.tag.album = date.year.to_s
79
- file.tag.artist = show[:name]
77
+ file.auto_tag!
80
78
  file.tag.year = date.year
81
- file.tag.title = date.to_s
82
79
 
83
80
  UnitF::Log.info("Auto Cover #{file.cover_path}")
84
81
  file.auto_cover!
85
82
  end
86
83
  end
87
84
 
88
- begin
89
- File.write(playlist_file, UnitF::Radio.playlist_tracks(show_dir).join("\n") + "\n")
90
- rescue StandardError => e
91
- puts "Error saving playlist for #{show[:name]} - #{e}"
92
- end
85
+ # playlist_file = "#{show_dir}/#{show[:name]}.m3u"
86
+ # begin
87
+ # File.write(playlist_file, UnitF::Radio.playlist_tracks(show_dir).join("\n") + "\n")
88
+ # rescue StandardError => e
89
+ # puts "Error saving playlist for #{show[:name]} - #{e}"
90
+ # end
93
91
  end
data/exe/wfmu CHANGED
@@ -21,11 +21,13 @@ UnitF::Log.to_console
21
21
 
22
22
  shows.each do |show_id|
23
23
  target_dir = "#{opt[:base_dir]}/#{show_id}"
24
- playlist_file = "#{opt[:base_dir]}/#{show_id}.m3u"
24
+
25
25
  UnitF::Radio::WFMU::process_show(show_id, target_dir)
26
- begin
27
- File.write(playlist_file, UnitF::Radio.playlist_tracks(target_dir).join("\n") + "\n")
28
- rescue StandardError => e
29
- puts "Error saving playlist for #{show_id}"
30
- end
26
+
27
+ # playlist_file = "#{opt[:base_dir]}/#{show_id}.m3u"
28
+ # begin
29
+ # File.write(playlist_file, UnitF::Radio.playlist_tracks(target_dir).join("\n") + "\n")
30
+ # rescue StandardError => e
31
+ # puts "Error saving playlist for #{show_id}"
32
+ # end
31
33
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module UnitF
4
4
  module Radio
5
- VERSION = "0.2.1"
5
+ VERSION = "0.2.5"
6
6
  end
7
7
  end
@@ -1,4 +1,5 @@
1
1
  require 'faraday'
2
+ require 'fileutils'
2
3
  require 'nokogiri'
3
4
  require 'open-uri'
4
5
 
@@ -9,30 +10,37 @@ module UnitF
9
10
  module Radio
10
11
  module WFMU
11
12
  class << self
12
- def process_episode(show_id, title, url, date, target_dir)
13
+ def process_episode(show_id, title, url, date, base_dir)
13
14
  source_url = Faraday.get(url).body.strip
14
15
  file = source_url.split('/')[-1]
16
+
17
+ matches = file.match(/^\w\w(\d\d)/)
18
+
19
+ if matches.nil?
20
+ UnitF::Log.warn("I don't understand how to process #{file}")
21
+ return
22
+ end
23
+
24
+ year = matches[1].to_i + 2000
25
+
26
+ target_dir = "#{base_dir}/#{year}"
15
27
  target_path = "#{target_dir}/#{file}"
16
28
 
17
- if File.exists?(target_path)
29
+ if File.exist?(target_path)
18
30
  UnitF::Log.info("File #{target_path} already exists")
19
31
  return
20
32
  end
21
33
 
22
- Dir.mkdir(target_dir) unless Dir.exist?(target_dir)
34
+ # Dir.mkdir(target_dir) unless Dir.exist?(target_dir)
35
+ FileUtils.mkpath(target_dir) unless Dir.exist?(target_dir)
23
36
 
24
37
  cmd = %Q( curl "#{source_url}" -o "#{target_path}")
25
38
  UnitF::Log.info("Downloading #{file} with command #{cmd}")
26
39
  system(cmd)
27
40
 
28
41
  UnitF::Tag.update(target_path) do |file|
29
- tags = file.auto_tags
30
-
31
- file.tag.album = "#{show_id} #{date.year}" unless tags.key?(:album)
32
- file.tag.album = "#{tags.fetch(:album)} #{date.year}" if tags.key?(:album)
33
- file.tag.artist = 'WFMU'
34
- file.tag.year = date.year
35
- file.tag.title = ::File.basename(target_path).gsub('.mp3', '')
42
+ file.auto_tag!
43
+ file.tag.year = year
36
44
 
37
45
  UnitF::Log.info("Auto Cover #{file.cover_path}")
38
46
  file.auto_cover!
@@ -51,17 +59,17 @@ module UnitF
51
59
  end
52
60
  end
53
61
 
54
- def show_map
55
- {
56
- BJ: 'Put The Needle On The Record',
57
- FP: 'Fool\'s Paradise',
58
- DB: 'Gateway to Joy',
59
- FR: 'Strength Through Failure',
60
- CR: 'Sinner\'s Crossroads',
61
- DN: 'Daniel Blumin',
62
- GJ: 'Glen Jones'
63
- }
64
- end
62
+ # def show_map
63
+ # {
64
+ # BJ: 'Put The Needle On The Record',
65
+ # FP: 'Fool\'s Paradise',
66
+ # DB: 'Gateway to Joy',
67
+ # FR: 'Strength Through Failure',
68
+ # CR: 'Sinner\'s Crossroads',
69
+ # DN: 'Daniel Blumin',
70
+ # GJ: 'Glen Jones'
71
+ # }
72
+ # end
65
73
  end
66
74
  end
67
75
  end
data/unitf-radio.gemspec CHANGED
@@ -32,5 +32,5 @@ Gem::Specification.new do |spec|
32
32
  spec.add_dependency "faraday"
33
33
  spec.add_dependency "nokogiri"
34
34
  spec.add_dependency "unitf-logging"
35
- spec.add_dependency "unitf-tag", ">= 0.1.23"
35
+ spec.add_dependency "unitf-tag"
36
36
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: unitf-radio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Baron
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-02-02 00:00:00.000000000 Z
10
+ date: 2025-03-30 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: faraday
@@ -58,14 +57,14 @@ dependencies:
58
57
  requirements:
59
58
  - - ">="
60
59
  - !ruby/object:Gem::Version
61
- version: 0.1.23
60
+ version: '0'
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - ">="
67
66
  - !ruby/object:Gem::Version
68
- version: 0.1.23
67
+ version: '0'
69
68
  description: Audio archiving
70
69
  email:
71
70
  - mwb@unitf.net
@@ -102,7 +101,6 @@ metadata:
102
101
  homepage_uri: http://www.github.com/mattbaron
103
102
  source_code_uri: http://www.github.com/mattbaron
104
103
  changelog_uri: http://www.github.com/mattbaron
105
- post_install_message:
106
104
  rdoc_options: []
107
105
  require_paths:
108
106
  - lib
@@ -117,8 +115,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
117
115
  - !ruby/object:Gem::Version
118
116
  version: '0'
119
117
  requirements: []
120
- rubygems_version: 3.5.14
121
- signing_key:
118
+ rubygems_version: 3.6.3
122
119
  specification_version: 4
123
120
  summary: Audio archiving
124
121
  test_files: []