Skip to content

Commit

Permalink
feat: Adding support for itunes lib ingestion and better logging
Browse files Browse the repository at this point in the history
  • Loading branch information
dabobert committed Nov 18, 2023
1 parent 9c552cc commit f7f82ce
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
1 change: 1 addition & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ gem 'eivu-fingerprinter-acoustid', git: 'https://github.com/eivu/fingerprinter-a
gem 'factory_bot', '~> 6.2.1' # factory_bot provides a framework and DSL for defining and using factories
gem 'faker', '~> 2.18' # Faker, a port of Data::Faker from Perl, is used to easily generate fake data: names, addresses, phone numbers, etc.
gem 'id3tag', '~> 1.1' # Native Ruby ID3 tag reader that aims for 100% coverage of ID3v2.x and ID3v1.x standards
gem 'itunes_parser', '~> 1.1', '>= 1.1.3' # Parses iTunes Library XML files
gem 'mimemagic', '~> 0.4.3' # Fast mime detection by extension or content (Uses freedesktop.org.xml shared-mime-info database
gem 'nokogiri', '~> 1.14' # xml parser
gem 'oj', '~> 3.16', '>= 3.16.1' # faster json parsing
Expand Down
5 changes: 5 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ GEM
concurrent-ruby (~> 1.0)
ice_nine (0.11.2)
id3tag (1.1.0)
itunes_parser (1.1.3)
nokogiri-plist (~> 0.5)
jmespath (1.6.1)
json (2.6.3)
language_server-protocol (3.17.0.3)
Expand All @@ -124,6 +126,8 @@ GEM
nokogiri (1.14.3)
mini_portile2 (~> 2.8.0)
racc (~> 1.4)
nokogiri-plist (0.5.0)
nokogiri
oj (3.16.1)
parallel (1.23.0)
parser (3.2.2.4)
Expand Down Expand Up @@ -206,6 +210,7 @@ DEPENDENCIES
factory_bot (~> 6.2.1)
faker (~> 2.18)
id3tag (~> 1.1)
itunes_parser (~> 1.1, >= 1.1.3)
mimemagic (~> 0.4.3)
nokogiri (~> 1.14)
oj (~> 3.16, >= 3.16.1)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Eivu::Client.new.upload_file path_to_file: '/Users/jinx/Downloads/PXL_20230124_1
Eivu::Client.new.upload_file path_to_file: 'spec/fixtures/samples/audio/brothers_grimm/the_frog_prince/paragraph1.mp3'
Eivu::Client.new.upload_folder path_to_folder: 'spec/fixtures/samples/audio/'
# multithread uploads are not recommended for audio files with cover art
Eivu::Client.new.upload_folder upload_folder_via_multithread: '/Users/jinx/Downloads/xfer'
Eivu::Client.new.upload_folder_via_multithread path_to_folder: '/Users/jinx/Downloads/xfer'
Eivu::Client.new.upload_folder peepy: true, nsfw: true, path_to_folder: '/Users/jinx/Downloads/xfer'
Eivu::Client.new.upload_folder peepy: true, nsfw: true, path_to_folder: '/Users/jinx/Downloads/xfer'
```
Expand Down
54 changes: 54 additions & 0 deletions notes/itunes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
require 'cgi'
ip = ItunesParser.new(file: "/Users/jinx/Library/CloudStorage/Dropbox/eivu/libraries/Huey\ Library.xml");:done
ip.doc['Library Persistent ID'] # "E37B10CB2E6C0187"
ip.doc["Music Folder"] # "file:///Users/jinx/Music/Music/Media.localized/"

lib_path = ip.doc["Music Folder"] # "file:///Users/jinx/Music/Music/Media.localized/"
music_path = lib_path + "Music/" # "file:///Users/jinx/Music/Music/Media.localized/Music/
track = ip.tracks.values.first


ip.tracks.values.last['Location']


/Users/jinx/Music/Amazon%20Music/Curtis%20Mayfield/Future%20Shock/02%20-%20Move%20on%20Up%20(ReMastered)_ffe88051-df14-4639-852b-09e1327e08f3.mp3
# [9] pry(main)> ip.playlists.last
# => {"Name"=>"Storybook",
# "Description"=>"Frog Prince in ascending order",
# "Playlist ID"=>6179,
# "Playlist Persistent ID"=>"FD85FEE1A260FD7F",
# "All Items"=>true,
# "Playlist Items"=>[{"Track ID"=>1634}, {"Track ID"=>1630}, {"Track ID"=>1632}, {"Track ID"=>1628}, {"Track ID"=>1626}]}


# {
# "Track ID"=>7905,
# "Name"=>"Move on Up (ReMastered)",
# "Artist"=>"Curtis Mayfield",
# "Album Artist"=>"Curtis Mayfield",
# "Album"=>"Future Shock",
# "Genre"=>"R&B",
# "Kind"=>"MPEG audio file",
# "Size"=>5653035,
# "Total Time"=>221779,
# "Disc Number"=>1,
# "Disc Count"=>1,
# "Track Number"=>2,
# "Track Count"=>14,
# "Year"=>2006,
# "Date Modified"=>#<DateTime: 2021-06-28T20:53:39+00:00 ((2459394j,75219s,0n),+0s,2299161j)>,
# "Date Added"=>#<DateTime: 2023-11-13T03:48:32+00:00 ((2460262j,13712s,0n),+0s,2299161j)>,
# "Bit Rate"=>202,
# "Sample Rate"=>44100,
# "Comments"=>"Amazon.com Song ID: 201458569",
# "Artwork Count"=>1,
# "Persistent ID"=>"876F5BB7682433F1",
# "Track Type"=>"File",
# "Location"=>
# "file:///Users/jinx/Music/Amazon%20Music/Curtis%20Mayfield/Future%20Shock/02%20-%20Move%20on%20Up%20(ReMastered)_ffe88051-df14-4639-852b-09e1327e08f3.mp3",
# "File Folder Count"=>-1,
# "Library Folder Count"=>-1
# }
# CGI.unescape ip.tracks.values.last['Location']
# /Users/jinx/Music/Amazon Music/Curtis Mayfield/Future Shock/02 - Move on Up (ReMastered)_ffe88051-df14-4639-852b-09e1327e08f3.mp3
# file:///Users/jinx/Music/Amazon Music/Curtis Mayfield/Future Shock/02 - Move on Up (ReMastered)_ffe88051-df14-4639-852b-09e1327e08f3.mp3

0 comments on commit f7f82ce

Please sign in to comment.