-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c8472cc
commit c9fccb4
Showing
6 changed files
with
209 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
module BiliPlaylist | ||
|
||
class BiliPlaylist | ||
|
||
def initialize(videos="") | ||
@videos = videos | ||
@videosHash = {} | ||
|
||
videosSplit | ||
end | ||
|
||
def videosSplit | ||
|
||
unless @videos.empty? then | ||
|
||
@videos.split(/\n/).each do |video| | ||
|
||
unless video.index("http://") then | ||
next | ||
end | ||
|
||
|
||
videoHashKey = "av" + video.gsub(/^.*\/av/,"").gsub(/\//,"") | ||
videoHashValue = video | ||
|
||
@videosHash[videoHashKey] = videoHashValue | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
|
||
def hash | ||
return @videosHash | ||
end | ||
|
||
def save(filename="") | ||
|
||
require 'fileutils' | ||
|
||
playlist = filename | ||
|
||
default_playlist = "#{$configPath}/biliplaylist.m3u8" | ||
|
||
if playlist.empty? then | ||
playlist = default_playlist | ||
end | ||
|
||
old_playlist = playlist + ".old" | ||
|
||
if File.exist?(playlist) then | ||
FileUtils.mv playlist, old_playlist | ||
else | ||
io = File.open(playlist,"w") | ||
io.puts "#EXTM3U" | ||
|
||
@videosHash.to_a.each do |video| | ||
io.puts "#EXTINF:#{video[0]}" | ||
io.puts video[1] | ||
end | ||
|
||
io.close | ||
end | ||
end | ||
|
||
def load(playlist="") | ||
|
||
playlistHash = {} | ||
|
||
default_playlist = "#{$configPath}/biliplaylist.m3u8" | ||
|
||
if playlist.empty? && File.exist?(default_playlist) then | ||
playlist = default_playlist | ||
end | ||
|
||
|
||
if playlist.empty? then | ||
p "[ERR] No playlist available!" | ||
else | ||
|
||
io = File.open(playlist, 'r') | ||
|
||
validArray = [] | ||
i = 0 | ||
|
||
io.each_line do |line| | ||
|
||
line.chomp! | ||
|
||
i += 1 | ||
|
||
unless line.index("http://") then | ||
next | ||
end | ||
|
||
unless line.index("bilibili") then | ||
p "#{line} doesn't seem to be a Bilibili URL!" | ||
else | ||
p line | ||
validArray[i] = line | ||
end | ||
|
||
end | ||
|
||
if validArray.empty? then | ||
p "This playlist has no URL we support!" | ||
end | ||
|
||
io.close | ||
end | ||
|
||
end | ||
|
||
end | ||
|
||
end |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,19 @@ | ||
* load URLs from a file and save currently pasted URLs to a file | ||
* let error message fade out | ||
* rework the GUI to use tabs for bilibili website | ||
* autoload playlists | ||
* capture more useful informations from console output | ||
* more error detecting | ||
* Bangou (avXXXX) paste support | ||
* custom look and feel | ||
* play history | ||
|
||
future: | ||
|
||
* download videos | ||
** use aria2 | ||
* upload videos | ||
* rewrite a native ruby Bilidan | ||
* fetch URL and extract stuff to fill bilibili.tv tab | ||
** develop a cache system, to compare timestamp, background update, etc | ||
* a navigation menu on bilibili tab and by default display top 10 videos with their link and preview image | ||
* rearrange the video URLs, if it's not played yet, then update the stack. | ||
* random play |