aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMelody Horn <melody@boringcactus.com>2019-02-26 21:53:17 -0700
committerMelody Horn <melody@boringcactus.com>2019-02-26 21:53:17 -0700
commit410a1416157afd78d2e3ddafcb44ca9584847a0e (patch)
treeb6082a15c65a7d09e7e70b275163e9b39a3337d3
parent64a371f232052e550d3c4832545fcfb6dab11d8e (diff)
downloadvidslice-410a1416157afd78d2e3ddafcb44ca9584847a0e.tar.gz
vidslice-410a1416157afd78d2e3ddafcb44ca9584847a0e.zip
prep for travis-based deployment
-rw-r--r--.travis.yml18
-rw-r--r--README.md10
-rw-r--r--screenshot.pngbin0 -> 29314 bytes
-rw-r--r--sources.py25
-rw-r--r--vidslice.py37
5 files changed, 79 insertions, 11 deletions
diff --git a/.travis.yml b/.travis.yml
new file mode 100644
index 0000000..0a6541d
--- /dev/null
+++ b/.travis.yml
@@ -0,0 +1,18 @@
+language: python
+os:
+ - linux
+ - osx
+ - windows
+python: '3.6'
+after_success:
+ - python setup.py build
+ - ls build
+deploy:
+ skip_cleanup: true
+ provider: releases
+ api_key:
+ secure: nKhTmc56igTYfpK0nxVcAmV59exVnWe3TWl4ZJ4XaQ7SjFIXcuraXzkVErT8Si4XfEVm1USlHt8K/lE8tavMzXGwWknLLbrxcIXMPJ/LTu/rF3Q6+0jXypLxv4dTPIj5cFsrzjoGSV7zqZ6ajrWcPaPk3OI5MhWHnAMkY+2RImBh+KEHlmve1drsWo1Sne4J+3kJibIMNqWlcY2RXOmMN47Ouw/an6Lgbq9PGeNwjwZxrARXJ5G3Kiv7WjTlowpFEyI3ECadfOlWA5yQIO3ko2S33Qsi7rbmin2DZjxtWFxsQ+M3+6F7yR0u+dK09TAidXY1g0f86eTq4ESr8n+gfGVI2rrRyG7A5+qHVUZv92CPcpq+EfdLKbGlIXV3Avtm0POQKmr7LHboBpKsAO2Tf6Rkkxe6C4s3uIKVqnB8XnDMfe+JbApgtCpyLaiUiRmlFrfK6Gw7deAUs5qA4qSMFU7Fal13rBnlZH8Wyx3nkNAD1ZOnS2WyTN309/HmxzKVXp+3GgfhSr9eA2r9guKC1yM++JgewASr91mqHwFsS1cl8rtSTDzht5q3U8SCjg4MKK15qF2Bb5NsJ1o5O4T30kcS5dWmO0mND6c/BesucMdK5duQU/qYstvNEjUfJ5G0p8+VdPrum40wKH+8ytFSB4YJPwmidUvxG6j2pnBx/PU=
+ file: foo
+ on:
+ repo: boringcactus/vidslice
+ tags: true
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b2cbb48
--- /dev/null
+++ b/README.md
@@ -0,0 +1,10 @@
+# vidslice
+
+video manipulator wrapping youtube-dl and ffmpeg
+
+![screenshot of vidslice demonstrating options](screenshot.png)
+
+## Installing
+Download the .zip for your preferred OS [here](https://github.com/boringcactus/vidslice/releases/latest).
+You may also need to [download ffmpeg](https://ffmpeg.org/download.html#get-packages) (if you're on Windows, you want Windows Builds and then the default options are fine) and [download youtube-dl](https://rg3.github.io/youtube-dl/download.html).
+Both of those will give you some executables; you can place them in the same folder as your downloaded vidslice.exe and that should work.
diff --git a/screenshot.png b/screenshot.png
new file mode 100644
index 0000000..d6d0e15
--- /dev/null
+++ b/screenshot.png
Binary files differ
diff --git a/sources.py b/sources.py
index f15f3b3..a8a1611 100644
--- a/sources.py
+++ b/sources.py
@@ -1,5 +1,6 @@
import glob
import json
+import os
import subprocess
import tempfile
import threading
@@ -15,6 +16,30 @@ def has_ytdl():
return False
+def update_ytdl(parent_win):
+ try:
+ youtube_dl_found = subprocess.run(['where', 'youtube-dl'], stdout=subprocess.PIPE, text=True)
+ except FileNotFoundError:
+ youtube_dl_found = subprocess.run(['which', 'youtube-dl'], stdout=subprocess.PIPE, text=True)
+ if youtube_dl_found.returncode != 0:
+ def poll():
+ answer = wx.MessageBox("Could not find youtube-dl. Open vidslice README?", "Error", wx.YES_NO, parent_win)
+ if answer == wx.YES:
+ import webbrowser
+ webbrowser.open("https://github.com/boringcactus/vidslice/blob/master/README.md")
+ return
+
+ wx.CallAfter(poll)
+ youtube_dl_path = youtube_dl_found.stdout.split("\n")[0]
+ old_mtime = os.stat(youtube_dl_path).st_mtime
+ proc = subprocess.run(["youtube-dl", "-U"], stdout=subprocess.PIPE, text=True)
+ if not proc.stdout.startswith("youtube-dl is up-to-date"):
+ while os.stat(youtube_dl_path).st_mtime == old_mtime:
+ from time import sleep
+ sleep(0.25)
+ wx.CallAfter(lambda: wx.MessageBox("Updated youtube-dl successfully", "Complete", wx.OK, parent_win))
+
+
class SourcesPanel(wx.Panel):
"""
A Panel representing source info
diff --git a/vidslice.py b/vidslice.py
index 6cf157c..502fb06 100644
--- a/vidslice.py
+++ b/vidslice.py
@@ -1,3 +1,4 @@
+import subprocess
import sys
import wx
@@ -5,7 +6,15 @@ import wx.adv
from options import OptionsPanel
from output import OutputPanel
-from sources import SourcesPanel
+from sources import SourcesPanel, update_ytdl
+
+
+def has_ffmpeg():
+ try:
+ subprocess.run(["ffmpeg", "-version"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
+ return True
+ except FileNotFoundError:
+ return False
class VidsliceFrame(wx.Frame):
@@ -60,7 +69,7 @@ class VidsliceFrame(wx.Frame):
file_menu = wx.Menu()
# The "\t..." syntax defines an accelerator key that also triggers
# the same event
- hello_item = file_menu.Append(-1, "&Hello...\tCtrl-H")
+ update_item = file_menu.Append(-1, "Update youtube-dl")
file_menu.AppendSeparator()
# When using a stock ID we don't need to specify the menu item's
# label
@@ -84,7 +93,7 @@ class VidsliceFrame(wx.Frame):
# Finally, associate a handler function with the EVT_MENU event for
# each of the menu items. That means that when that menu item is
# activated then the associated handler function will be called.
- self.Bind(wx.EVT_MENU, self.on_hello, hello_item)
+ self.Bind(wx.EVT_MENU, self.on_update, update_item)
self.Bind(wx.EVT_MENU, self.on_exit, exit_item)
self.Bind(wx.EVT_MENU, self.on_about, about_item)
@@ -92,17 +101,16 @@ class VidsliceFrame(wx.Frame):
"""Close the frame, terminating the application."""
self.Close(True)
- def on_hello(self, event):
- """Say hello to the user."""
- wx.MessageBox("Hello again from wxPython")
+ def on_update(self, event):
+ import threading
+ threading.Thread(target=update_ytdl, args=(self,)).start()
def on_about(self, event):
"""Display an About Dialog"""
info = wx.adv.AboutDialogInfo()
info.SetName("vidslice")
info.SetDescription("video manipulator wrapping youtube-dl and ffmpeg")
- info.SetDevelopers(["Melody Horn"])
- info.SetWebSite("https://www.boringcactus.com")
+ info.SetWebSite("https://github.com/boringcactus/vidslice")
wx.adv.AboutBox(info)
@@ -111,7 +119,14 @@ if __name__ == '__main__':
# When this module is run (not imported) then create the app, the
# frame, show it, and start the event loop.
app = wx.App()
- frm = VidsliceFrame(None, title='vidslice')
- app.SetTopWindow(frm)
- frm.Show()
+ if not has_ffmpeg():
+ answer = wx.MessageBox("Could not find ffmpeg. Open vidslice README?", "Error", wx.YES_NO, None)
+ if answer == wx.YES:
+ import webbrowser
+
+ webbrowser.open("https://github.com/boringcactus/vidslice/blob/master/README.md")
+ else:
+ frm = VidsliceFrame(None, title='vidslice')
+ app.SetTopWindow(frm)
+ frm.Show()
app.MainLoop()