atomic-parsley-ruby 0.0.2 → 0.0.3

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
  SHA1:
3
- metadata.gz: 640cc925a89214a5a531fd63dbb34e048104ee6f
4
- data.tar.gz: f1c48d179bce009509e4553a4e657fb7d5657f8a
3
+ metadata.gz: 5201be93b77c67fa86d1d9d3c0c1f43da0542dd2
4
+ data.tar.gz: fd8b1a42ea2c924136274ce60ea29223aae61014
5
5
  SHA512:
6
- metadata.gz: 9d8483e90323090ef42c4ef7d0451469180f7501491be87718c0dd0ce09fbe766659836ebfac8b0850926621ed1e613a0bf1b2598c456c9afdbee2c0ee3eec06
7
- data.tar.gz: 2babe84569bca3459c7cd4692005f276206c5905ad6f49878a1079f86e372d73d0f58bea5cfb380e887a7fb545d19f323f1e504fb3c71324052121fd30648934
6
+ metadata.gz: 17c680ddad81cbe6570193d967542377238a379961d34d09885c2133885b2cd48d62d9a373aa9008abf0c4d055f1d7a2ecf2950f884d65e37cda43579b02b49b
7
+ data.tar.gz: 83492d905a8194303211fd9480740ae2b17fe201239e63995a6750331b59932dba08a0cbfca861d625b87b5eecac8e7896acf55779a174b6bf854278b410ab66
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # AtomicParsleyRuby
2
2
 
3
- A wrapper api for the atomicparsley cli. This is good for scripting out bulk media meta encodeing. It has been tested on mp3, mp4, and m4v
3
+ A wrapper api for the atomicparsley cli. Made for scripting out bulk media meta encodings in ruby. It has been tested on mp3, mp4, and m4v.
4
4
 
5
5
  ## Installation
6
6
 
@@ -0,0 +1,98 @@
1
+ module AtomicParsleyRuby
2
+ class Media
3
+ #This will raise a AtomicParsley::Dependecy::Exception
4
+ #or a AtomicParsley::File::Exception if things go wrong
5
+
6
+ def initialize(file_name)
7
+ @file = ::Shellwords.escape(file_name)
8
+ @params = {}
9
+ end
10
+
11
+ # --artist (string) Set the artist tag\n"
12
+ # --title (string) Set the title tag\n"
13
+ # --album (string) Set the album tag\n"
14
+ # --genre (string) Genre tag (see --longhelp for more info)\n"
15
+ # --tracknum (num)[/tot] Track number (or track number/total tracks)\n"
16
+ # --disk (num)[/tot] Disk number (or disk number/total disks)\n"
17
+ # --comment (string) Set the comment tag\n"
18
+ # --year (num|UTC) Year tag (see --longhelp for \"Release Date\")\n"
19
+ # --lyrics (string) Set lyrics (not subject to 256 byte limit)\n"
20
+ # --composer (string) Set the composer tag\n"
21
+ # --copyright (string) Set the copyright tag\n"
22
+ # --grouping (string) Set the grouping tag\n"
23
+ # --artwork (/path) Set a piece of artwork (jpeg or png only)\n"
24
+ # --bpm (number) Set the tempo/bpm\n"
25
+ # --albumArtist (string) Set the album artist tag\n"
26
+ # --compilation (boolean) Set the compilation flag (true or false)\n"
27
+ # --hdvideo (boolean) Set the hdvideo flag (true or false)\n"
28
+ # --advisory (string*) Content advisory (*values: 'clean', 'explicit')\n"
29
+ # --stik (string*) Sets the iTunes \"stik\" atom (see --longhelp)\n"
30
+ # --description (string) Set the description tag\n"
31
+ # --longdesc (string) Set the long description tag\n"
32
+ # --TVNetwork (string) Set the TV Network name\n"
33
+ # --TVShowName (string) Set the TV Show name\n"
34
+ # --TVEpisode (string) Set the TV episode/production code\n"
35
+ # --TVSeasonNum (number) Set the TV Season number\n"
36
+ # --TVEpisodeNum (number) Set the TV Episode number\n"
37
+ # --podcastFlag (boolean) Set the podcast flag (true or false)\n"
38
+ # --category (string) Sets the podcast category\n"
39
+ # --keyword (string) Sets the podcast keyword\n"
40
+ # --podcastURL (URL) Set the podcast feed URL\n"
41
+ # --podcastGUID (URL) Set the episode's URL tag\n"
42
+ # --purchaseDate (UTC) Set time of purchase\n"
43
+ # --encodingTool (string) Set the name of the encoder\n"
44
+ # --encodedBy (string) Set the name of the Person/company who encoded the file\n"
45
+ # --apID (string) Set the Account Name\n"
46
+ # --cnID (number) Set the iTunes Catalog ID (see --longhelp)\n"
47
+ # --xid (string) Set the vendor-supplied iTunes xID (see --longhelp)\n"
48
+ # --gapless (boolean) Set the gapless playback flag\n"
49
+ # --contentRating (string*) Set tv/mpaa rating (see -rDNS-help)\n"
50
+
51
+
52
+ [:artist, :title, :album,
53
+ :genre, :tracknum, :disk,
54
+ :comment, :year, :lyrics,
55
+ :composer, :copyrights,
56
+ :grouping, :artwork, :bpm, :description,
57
+ :albumArtist, :compilation, :hdvideo,
58
+ :advisory, :stick, :desctiption,
59
+ :longdesc, :TVNetwork, :TVShowName,
60
+ :TVEpisode, :TVSeasonNum, :TVEpisodeNum,
61
+ :podcastFlag, :category, :keyword,
62
+ :podcastURL, :podcastGUID, :purchaseDate,
63
+ :encodingTool, :encodedBy, :apID,
64
+ :cnID, :xid, :gappless,
65
+ :contentRating].each do |method|
66
+ define_method(method) do |arg|
67
+ @params["--#{method}"] = ::Shellwords.escape(arg)
68
+ end
69
+ end
70
+
71
+ def encode
72
+ ::AtomicParsleyRuby::File.valid? @file
73
+
74
+ if block_given?
75
+ yield self
76
+ self.process
77
+ else
78
+ #todo: I should raise an eception here.....
79
+ #puts "no block"
80
+ end
81
+ end
82
+
83
+ def process
84
+ cmd_str = self.cmd
85
+ #puts "Running #{cmd_str}"
86
+ system(cmd_str)
87
+ end
88
+
89
+ def cmd
90
+ ret = ::AtomicParsleyRuby::Dependency.path
91
+ unless @params.empty?
92
+ ret << " #{@file}"
93
+ @params.each {|flag, arg| ret << " #{flag} #{arg}"}
94
+ end
95
+ ret
96
+ end
97
+ end
98
+ end
@@ -1,3 +1,3 @@
1
1
  module AtomicParsleyRuby
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
@@ -0,0 +1,40 @@
1
+ require "spec_helper"
2
+
3
+ module AtomicParsleyRuby
4
+ describe Media do
5
+ [:artist, :title, :album,
6
+ :genre, :tracknum, :disk,
7
+ :comment, :year, :lyrics,
8
+ :composer, :copyrights,
9
+ :grouping, :artwork, :bpm, :description,
10
+ :albumArtist, :compilation, :hdvideo,
11
+ :advisory, :stick, :desctiption,
12
+ :longdesc, :TVNetwork, :TVShowName,
13
+ :TVEpisode, :TVSeasonNum, :TVEpisodeNum,
14
+ :podcastFlag, :category, :keyword,
15
+ :podcastURL, :podcastGUID, :purchaseDate,
16
+ :encodingTool, :encodedBy, :apID,
17
+ :cnID, :xid, :gappless,
18
+ :contentRating].each do |flag|
19
+ it "responds to #{flag}" do
20
+ ::AtomicParsleyRuby::Dependency.stubs(:path).returns("AtomicParsley")
21
+ v = Media.new("test.mp4")
22
+ v.send(flag, "test-value")
23
+ v.cmd.should eq "AtomicParsley test.mp4 --#{flag.to_s} test-value"
24
+ end
25
+ end
26
+
27
+ it "sets multiple flags using the encode block" do
28
+ ::AtomicParsleyRuby::Dependency.stubs(:path).returns("AtomicParsley")
29
+ v = Media.new("test.mp4")
30
+ stubs(:system).with("AtomicParsley test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock").returns("Great Success")
31
+ v.encode do |config|
32
+ config.artist "Some Guy"
33
+ config.year "2012"
34
+ config.genre "Punk Rock"
35
+ end
36
+ v.cmd.should eq "AtomicParsley test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock test.mp4 --artist Some\\ Guy --year 2012 --genre Punk\\ Rock"
37
+ end
38
+
39
+ end
40
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: atomic-parsley-ruby
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
  - cparratto
@@ -83,9 +83,11 @@ files:
83
83
  - lib/atomic-parsley-ruby/dependency.rb
84
84
  - lib/atomic-parsley-ruby/exception.rb
85
85
  - lib/atomic-parsley-ruby/file.rb
86
+ - lib/atomic-parsley-ruby/media.rb
86
87
  - lib/atomic-parsley-ruby/version.rb
87
88
  - spec/dependency_spec.rb
88
89
  - spec/file_spec.rb
90
+ - spec/media_spec.rb
89
91
  - spec/spec_helper.rb
90
92
  homepage: https://github.com/cparratto/atomic-parsley-ruby
91
93
  licenses:
@@ -115,4 +117,5 @@ summary: I take no major credit for this its simply just a wrapper for the c app
115
117
  test_files:
116
118
  - spec/dependency_spec.rb
117
119
  - spec/file_spec.rb
120
+ - spec/media_spec.rb
118
121
  - spec/spec_helper.rb