tubedl 0.1.6 → 0.1.7

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: 9bc12094f42b4d4ab4d60063927c549715f4fe9a
4
- data.tar.gz: 77e226d742df032c363461f652f4b21063b6e311
3
+ metadata.gz: 01a437e788d6e1ec6f728524adf239c7be3728b0
4
+ data.tar.gz: 855dacbffac695d8d820f6706a70153768baca07
5
5
  SHA512:
6
- metadata.gz: 7b66e6afb13ccb383b8f8323e86473cd4cfacc3db33da002772e07a0ce6ab36be4528ea358b0b358e1edcb864ac2f518f5f4c931869e823ae15271e7e916574a
7
- data.tar.gz: aab5a344e51fd8d60e7f6b15e88eb56b93f6a7a9aa97cdec30f9fe96c6198d78a59fa759d5d93e7645147ac19b92f9f71c060074847c1a8dd3dfc9f05e9d9cbb
6
+ metadata.gz: f895cfab30db61ad2c78b0a6703dfe68c69c994ee80dfd417f821654985b4803b7ab1cfe52f806207010fb971b6e15ec4e5ad359a8dfddc0c328fd644d876efc
7
+ data.tar.gz: cf90cbf78c801ce49ffb1ddad606b5f9668c99aff26efcb26ee0f68b53afb7c310d5aa88276df08107627c1fd5e72d9cbee62f03797a2a828453b2f06677f0a7
@@ -0,0 +1,45 @@
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
@@ -0,0 +1 @@
1
+ ./gcaglar@gokhan-busra-9582.8822:1503153049
data/README.md CHANGED
@@ -34,7 +34,7 @@ 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
37
+ metallica.save_playlist # That will create a smplayer playlist
38
38
  # Tubedl.load_playlist(path)
39
39
  Tubedl.save_object(metallica)
40
40
 
@@ -65,4 +65,4 @@ The gem is available as open source under the terms of the [MIT License](http://
65
65
 
66
66
  ## Code of Conduct
67
67
 
68
- Everyone interacting in the Tubedl project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tubedl/blob/master/CODE_OF_CONDUCT.md).
68
+ Everyone interacting in the Tubedl project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/tubedl/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,46 @@
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
+
@@ -0,0 +1 @@
1
+ lib/gcaglar@gokhan-busra-9582.8822:1503153049
@@ -6,40 +6,40 @@ require 'yaml'
6
6
 
7
7
  module Tubedl
8
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'
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
17
  }
18
-
18
+
19
19
  def self.get_videoID(link)
20
20
  link.match(PlaylistParser::YoutubeRegex)[5]
21
21
  end
22
22
 
23
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: #{urlHash}"
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)
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
43
  File.write("#{object}.yml", YAML.dump(object))
44
44
  end
45
- end
45
+ end
@@ -44,5 +44,14 @@ module PlaylistParser
44
44
  def save_playlist
45
45
  File.write("Playlist-#{Time.now.to_a[3..5].join('-')}.yml", @playlist_data.to_yaml)
46
46
  end
47
+
48
+ def save_smplayer_playlist
49
+ f = File.open("smplayerPlaylist-#{@playlistID}-#{Time.now.to_a[3..5].join('-')}.m3u", "w+")
50
+ f.write("#EXTM3U\n")
51
+ @playlist_data.each_pair do |k, v|
52
+ f.puts("#EXTINF:0,#{k}\n#{v}\n")
53
+ end
54
+ f.close
55
+ end
47
56
  end
48
57
  end
@@ -1,3 +1,3 @@
1
1
  module Tubedl
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tubedl
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gökhan Çağlar
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-08-15 00:00:00.000000000 Z
11
+ date: 2017-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -77,6 +77,8 @@ executables: []
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
+ - "#tubedl.gemspec#"
81
+ - ".#tubedl.gemspec"
80
82
  - ".gitignore"
81
83
  - ".idea/.rakeTasks"
82
84
  - ".idea/dictionaries/gokhan.xml"
@@ -95,6 +97,8 @@ files:
95
97
  - Rakefile
96
98
  - bin/console
97
99
  - bin/setup
100
+ - lib/#tubedl.rb#
101
+ - lib/.#tubedl.rb
98
102
  - lib/tubedl.rb
99
103
  - lib/tubedl/playlist_parser.rb
100
104
  - lib/tubedl/version.rb