itunes_video 0.1.3 → 0.2.0
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.
- data/lib/itunes_video.rb +19 -4
- metadata +2 -2
data/lib/itunes_video.rb
CHANGED
@@ -3,7 +3,7 @@ class Itunes_video
|
|
3
3
|
require 'pathname'
|
4
4
|
require 'fileutils'
|
5
5
|
|
6
|
-
attr_accessor :id, :kind, :name, :genre, :year, :description, :comment, :unplayed, :rating, :season_num, :episode_num, :show_name
|
6
|
+
attr_accessor :id, :kind, :category, :name, :genre, :year, :description, :comment, :unplayed, :played_count, :rating, :season_num, :episode_num, :show_name
|
7
7
|
|
8
8
|
def initialize(file)
|
9
9
|
if !(Pathname.new file).absolute?
|
@@ -34,6 +34,14 @@ class Itunes_video
|
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
37
|
+
def category=(category)
|
38
|
+
if `osascript -e 'tell application \"iTunes\" to set category of file track id #{@id} to \"#{category}\"'`
|
39
|
+
@category = category
|
40
|
+
else
|
41
|
+
raise "could not set 'category' for video"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
37
45
|
# sets episode name for tv show or movie title for movie
|
38
46
|
def name=(name)
|
39
47
|
if `osascript -e 'tell application \"iTunes\" to set name of file track id #{@id} to \"#{name}\"'`
|
@@ -89,11 +97,18 @@ class Itunes_video
|
|
89
97
|
end
|
90
98
|
end
|
91
99
|
|
100
|
+
def played_count=(played_count)
|
101
|
+
if `osascript -e 'tell application \"iTunes\" to set played count of file track id #{@id} to #{played_count.to_i}'`
|
102
|
+
@played_count = played_count
|
103
|
+
else
|
104
|
+
raise "could not set 'played count' for video"
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
92
108
|
def rating=(rating)
|
93
|
-
|
94
|
-
if !rating_int.between?(0,100)
|
109
|
+
if !rating.to_i.between?(0,100)
|
95
110
|
raise "rating must be between 0 and 100"
|
96
|
-
elsif `osascript -e 'tell application \"iTunes\" to set rating of file track id #{@id} to #{
|
111
|
+
elsif `osascript -e 'tell application \"iTunes\" to set rating of file track id #{@id} to #{rating.to_i}'`
|
97
112
|
@rating = rating
|
98
113
|
else
|
99
114
|
raise "could not set 'rating' for video"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: itunes_video
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-05-10 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A gem to import and organize your video collection in iTunes. OS X only.
|
15
15
|
email: rick.myers@me.com
|