tubedl 0.1.7 → 0.1.8

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: 01a437e788d6e1ec6f728524adf239c7be3728b0
4
- data.tar.gz: 855dacbffac695d8d820f6706a70153768baca07
3
+ metadata.gz: f7aca0352bc49355aee142f0913903b18d5d7d96
4
+ data.tar.gz: 1fc9bc03efc8b2ed356cb2244e7b850668c74ba9
5
5
  SHA512:
6
- metadata.gz: f895cfab30db61ad2c78b0a6703dfe68c69c994ee80dfd417f821654985b4803b7ab1cfe52f806207010fb971b6e15ec4e5ad359a8dfddc0c328fd644d876efc
7
- data.tar.gz: cf90cbf78c801ce49ffb1ddad606b5f9668c99aff26efcb26ee0f68b53afb7c310d5aa88276df08107627c1fd5e72d9cbee62f03797a2a828453b2f06677f0a7
6
+ metadata.gz: 13fdfa527bc320f182c21987801a99e66ab41e5b6b7159ae99c70c5133d1ad769a1914ccf88bc8536c054bfdf4122bea1562c18645403eefa1d89418384c7abf
7
+ data.tar.gz: 78d6aa427cf44a6ded8771cfefae051189bb2d408147b0828d3abec2c85b208b2907e745e69cb2cf8d31badd41da3646b0e392d97b580dc684d722040f8bbeac
data/README.md CHANGED
@@ -34,7 +34,11 @@ video_list = metallica.playlist_data
34
34
  dowload_links = metallica.playlist_data.values
35
35
  whole_page_data = Tubedl.get_page_data(first_song_link)
36
36
  specific_resulation = Tubedl.set_quality(first_song_link, 'hd1080')
37
- metallica.save_playlist # That will create a smplayer playlist
37
+ metallica.save_playlist
38
+ metallica.save_smplayer_playlist # That will create a smplayer playlist
39
+ # Also can pass path as argument
40
+ metallica.save_smplayer_playlist '/home/gcaglar/Music'
41
+ metallica.save_playlist '/home/gcaglar/Music'
38
42
  # Tubedl.load_playlist(path)
39
43
  Tubedl.save_object(metallica)
40
44
 
@@ -41,12 +41,12 @@ module PlaylistParser
41
41
 
42
42
 
43
43
 
44
- def save_playlist
45
- File.write("Playlist-#{Time.now.to_a[3..5].join('-')}.yml", @playlist_data.to_yaml)
44
+ def save_playlist(path_to_save = nil)
45
+ File.write("#{path_to_save || '.'}/Playlist-#{Time.now.to_a[3..5].join('-')}.yml", @playlist_data.to_yaml)
46
46
  end
47
47
 
48
- def save_smplayer_playlist
49
- f = File.open("smplayerPlaylist-#{@playlistID}-#{Time.now.to_a[3..5].join('-')}.m3u", "w+")
48
+ def save_smplayer_playlist(path_to_save = nil)
49
+ f = File.open("#{path_to_save || '.'}/smplayerPlaylist-#{@playlistID}-#{Time.now.to_a[3..5].join('-')}.m3u", "w+")
50
50
  f.write("#EXTM3U\n")
51
51
  @playlist_data.each_pair do |k, v|
52
52
  f.puts("#EXTINF:0,#{k}\n#{v}\n")
@@ -1,3 +1,3 @@
1
1
  module Tubedl
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
@@ -11,10 +11,12 @@ Gem::Specification.new do |spec|
11
11
 
12
12
  spec.summary = %q{This gem parses youtube playlists to an object with an instance that named as playlist_data(hash: video_names => links)
13
13
  also can save that instance as yaml, can check a video link format with regex, can create link to specific resulation
14
- can take whole page data of a link, can take video ID from link and can save object as yaml }
14
+ can take whole page data of a link, can take video ID from link and can save object as yaml and also can save a smplayer
15
+ compatible playlist file. Now user can pass path to save playlist for yaml and smplalyewr playlists. }
15
16
  spec.description = %q{This gem parses youtube playlists to an object with an instance that named as playlist_data(hash: video_names => links)
16
17
  also can save that instance as yaml, can check a video link format with regex, can create link to specific resulation
17
- can take whole page data of a link, can take video ID from link and can save object as yaml }
18
+ can take whole page data of a link, can take video ID from link and can save object as yaml can save a smplayer
19
+ compatible playlist file. Now user can pass path to save playlist for yaml and smplalyewr playlists.}
18
20
  spec.homepage = "https://github.com/cptangry/tubedl"
19
21
  spec.license = "MIT"
20
22
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tubedl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gökhan Çağlar
@@ -66,19 +66,17 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.8'
69
- description: "This gem parses youtube playlists to an object with an instance that
70
- named as playlist_data(hash: video_names => links)\n also
71
- can save that instance as yaml, can check a video link format with regex, can create
72
- link to specific resulation\n can take whole page data
73
- of a link, can take video ID from link and can save object as yaml "
69
+ description: |-
70
+ This gem parses youtube playlists to an object with an instance that named as playlist_data(hash: video_names => links)
71
+ also can save that instance as yaml, can check a video link format with regex, can create link to specific resulation
72
+ can take whole page data of a link, can take video ID from link and can save object as yaml can save a smplayer
73
+ compatible playlist file. Now user can pass path to save playlist for yaml and smplalyewr playlists.
74
74
  email:
75
75
  - caglar.gokhan@gmail.com
76
76
  executables: []
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
- - "#tubedl.gemspec#"
81
- - ".#tubedl.gemspec"
82
80
  - ".gitignore"
83
81
  - ".idea/.rakeTasks"
84
82
  - ".idea/dictionaries/gokhan.xml"
@@ -97,8 +95,6 @@ files:
97
95
  - Rakefile
98
96
  - bin/console
99
97
  - bin/setup
100
- - lib/#tubedl.rb#
101
- - lib/.#tubedl.rb
102
98
  - lib/tubedl.rb
103
99
  - lib/tubedl/playlist_parser.rb
104
100
  - lib/tubedl/version.rb
@@ -132,5 +128,6 @@ summary: 'This gem parses youtube playlists to an object with an instance that n
132
128
  as playlist_data(hash: video_names => links) also can save that instance as yaml,
133
129
  can check a video link format with regex, can create link to specific resulation
134
130
  can take whole page data of a link, can take video ID from link and can save object
135
- as yaml'
131
+ as yaml and also can save a smplayer compatible playlist file. Now user can pass
132
+ path to save playlist for yaml and smplalyewr playlists.'
136
133
  test_files: []
@@ -1,45 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path("../lib", __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require_relative "lib/tubedl/version"
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "tubedl"
8
- spec.version = Tubedl::VERSION
9
- spec.authors = ["Gökhan Çağlar"]
10
- spec.email = ["caglar.gokhan@gmail.com"]
11
-
12
- spec.summary = %q{This gem parses youtube playlists to an object with an instance that named as playlist_data(hash: video_names => links)
13
- also can save that instance as yaml, can check a video link format with regex, can create link to specific resulation
14
- can take whole page data of a link, can take video ID from link and can save object as yaml and also can save a smplayer
15
- compatible playlist file }
16
- spec.description = %q{This gem parses youtube playlists to an object with an instance that named as playlist_data(hash: video_names => links)
17
- also can save that instance as yaml, can check a video link format with regex, can create link to specific resulation
18
- can take whole page data of a link, can take video ID from link and can save object as yaml can save a smplayer
19
- compatible playlist file}
20
- spec.homepage = "https://github.com/cptangry/tubedl"
21
- spec.license = "MIT"
22
-
23
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
24
- # to allow pushing to a single host or delete this section to allow pushing to any host.
25
- if spec.respond_to?(:metadata)
26
- spec.metadata["allowed_push_host"] = "https://rubygems.org/"
27
- else
28
- raise "RubyGems 2.0 or newer is required to protect against " \
29
- "public gem pushes."
30
- end
31
-
32
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
33
- f.match(%r{^(test|spec|features)/})
34
- end
35
- spec.bindir = "bin"
36
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
37
- spec.require_paths = ["lib"]
38
-
39
- spec.required_ruby_version = '~> 2.0'
40
- spec.add_development_dependency "bundler", "~> 1.15"
41
- spec.add_development_dependency "rake", "~> 10.0"
42
- spec.add_development_dependency "minitest", "~> 5.0"
43
- spec.add_development_dependency "nokogiri", '~> 1.8'
44
-
45
- end
@@ -1 +0,0 @@
1
- ./gcaglar@gokhan-busra-9582.8822:1503153049
@@ -1,46 +0,0 @@
1
- require_relative 'tubedl/version'
2
- require_relative 'tubedl/playlist_parser'
3
- require 'nokogiri'
4
- require 'open-uri'
5
- require 'yaml'
6
-
7
- module Tubedl
8
- include PlaylistParser
9
-
10
- QULITIES = {
11
- hd1440: '?version=3&vq=hd1440',
12
- hd1080: '?version=3&vq=hd1080',
13
- hd720: '?version=3&vq=hd720',
14
- sd480: '?version=3&vq=large',
15
- sd360: '?version=3&vq=medium',
16
- sd240: '?version=3&vq=small'
17
- }
18
-
19
- def self.get_videoID(link)
20
- link.match(PlaylistParser::YoutubeRegex)[5]
21
- end
22
-
23
- def self.set_quality(str, quality)
24
- str + QULITIES[quality.to_sym]
25
- end
26
-
27
- def self.get_page_data(url)
28
- begin
29
- doc = Nokogiri::HTML(open(url).read)
30
- rescue Timeout::Error
31
- STDERR.puts "Timeout while connecting to: #{url}"
32
- STDERR.puts 'Retrying...'
33
- retry
34
- end
35
- doc
36
- end
37
-
38
- def self.load_playlist(file_path)
39
- YAML.load_file(file_path)
40
- end
41
-
42
- def self.save_object(object)
43
- File.write("#{object}.yml", YAML.dump(object))
44
- end
45
- end
46
-
@@ -1 +0,0 @@
1
- lib/gcaglar@gokhan-busra-9582.8822:1503153049