OpenShot Video Editor  2.0.0
version.py
Go to the documentation of this file.
1 ##
2 #
3 # @file
4 # @brief This file get the current version of openshot from the openshot.org website
5 # @author Jonathan Thomas <jonathan@openshot.org>
6 #
7 # @section LICENSE
8 #
9 # Copyright (c) 2008-2018 OpenShot Studios, LLC
10 # (http://www.openshotstudios.com). This file is part of
11 # OpenShot Video Editor (http://www.openshot.org), an open-source project
12 # dedicated to delivering high quality video editing and animation solutions
13 # to the world.
14 #
15 # OpenShot Video Editor is free software: you can redistribute it and/or modify
16 # it under the terms of the GNU General Public License as published by
17 # the Free Software Foundation, either version 3 of the License, or
18 # (at your option) any later version.
19 #
20 # OpenShot Video Editor is distributed in the hope that it will be useful,
21 # but WITHOUT ANY WARRANTY; without even the implied warranty of
22 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 # GNU General Public License for more details.
24 #
25 # You should have received a copy of the GNU General Public License
26 # along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
27 #
28 
29 import requests
30 import threading
31 from classes.app import get_app
32 from classes import info
33 from classes.logger import log
34 try:
35  import json
36 except ImportError:
37  import simplejson as json
38 
39 
40 ##
41 # Get the current version
43  t = threading.Thread(target=get_version_from_http)
44  t.start()
45 
46 ##
47 # Get the current version # from openshot.org
49 
50  url = "http://www.openshot.org/version/json/"
51 
52  # Send metric HTTP data
53  try:
54  r = requests.get(url, headers={"user-agent": "openshot-qt-%s" % info.VERSION}, verify=False)
55  log.info("Found current version: %s" % r.text)
56 
57  # Parse version
58  openshot_version = r.json()["openshot_version"]
59 
60  # Emit signal for the UI
61  get_app().window.FoundVersionSignal.emit(openshot_version)
62 
63  except Exception as Ex:
64  log.error("Failed to get version from: %s" % url)
def get_version_from_http
Get the current version # from openshot.org.
Definition: version.py:48
def get_app
Returns the current QApplication instance of OpenShot.
Definition: app.py:55
def get_current_Version
Get the current version.
Definition: version.py:42