aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartijn Kaijser <mcm.kaijser@gmail.com>2013-03-28 17:16:47 +0100
committerMartijn Kaijser <mcm.kaijser@gmail.com>2013-03-28 17:16:47 +0100
commit538da893c34fca951f952a39b6d1c08506008ee9 (patch)
tree41266cde35a23b1b14c07ef8e2f887e27e39c8c3
parent598cda322df04c2b0dcdb94c4e66575595a46cf8 (diff)
[addons] add version check script that notifies user if there's a newer version released compared to what he is running
-rw-r--r--addons/service.xbmc.versioncheck/LICENSE.txt282
-rw-r--r--addons/service.xbmc.versioncheck/README.md6
-rw-r--r--addons/service.xbmc.versioncheck/addon.xml23
-rw-r--r--addons/service.xbmc.versioncheck/changelog.txt5
-rw-r--r--addons/service.xbmc.versioncheck/icon.pngbin0 -> 26829 bytes
-rw-r--r--addons/service.xbmc.versioncheck/resources/language/English/strings.po69
-rw-r--r--addons/service.xbmc.versioncheck/resources/settings.xml6
-rw-r--r--addons/service.xbmc.versioncheck/resources/versions.txt190
-rw-r--r--addons/service.xbmc.versioncheck/service.py253
9 files changed, 834 insertions, 0 deletions
diff --git a/addons/service.xbmc.versioncheck/LICENSE.txt b/addons/service.xbmc.versioncheck/LICENSE.txt
new file mode 100644
index 0000000000..ab123ffca1
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/LICENSE.txt
@@ -0,0 +1,282 @@
+
+ GNU GENERAL PUBLIC LICENSE
+ Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+ 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users. This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it. (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.) You can apply it to
+your programs, too.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+ To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+ For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have. You must make sure that they, too, receive or can get the
+source code. And you must show them these terms so they know their
+rights.
+
+ We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+ Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software. If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+ Finally, any free program is threatened constantly by software
+patents. We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary. To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ GNU GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License. The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language. (Hereinafter, translation is included without limitation in
+the term "modification".) Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+ 1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+ 2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) You must cause the modified files to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ b) You must cause any work that you distribute or publish, that in
+ whole or in part contains or is derived from the Program or any
+ part thereof, to be licensed as a whole at no charge to all third
+ parties under the terms of this License.
+
+ c) If the modified program normally reads commands interactively
+ when run, you must cause it, when started running for such
+ interactive use in the most ordinary way, to print or display an
+ announcement including an appropriate copyright notice and a
+ notice that there is no warranty (or else, saying that you provide
+ a warranty) and that users may redistribute the program under
+ these conditions, and telling the user how to view a copy of this
+ License. (Exception: if the Program itself is interactive but
+ does not normally print such an announcement, your work based on
+ the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+ a) Accompany it with the complete corresponding machine-readable
+ source code, which must be distributed under the terms of Sections
+ 1 and 2 above on a medium customarily used for software interchange; or,
+
+ b) Accompany it with a written offer, valid for at least three
+ years, to give any third party, for a charge no more than your
+ cost of physically performing source distribution, a complete
+ machine-readable copy of the corresponding source code, to be
+ distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+
+ c) Accompany it with the information you received as to the offer
+ to distribute corresponding source code. (This alternative is
+ allowed only for noncommercial distribution and only if you
+ received the program in object code or executable form with such
+ an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it. For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable. However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License. Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+ 5. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Program or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+ 6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+ 7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all. For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded. In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+ 9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time. Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation. If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+ 10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission. For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this. Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+ NO WARRANTY
+
+ 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+ 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+-------------------------------------------------------------------------
diff --git a/addons/service.xbmc.versioncheck/README.md b/addons/service.xbmc.versioncheck/README.md
new file mode 100644
index 0000000000..608296aaae
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/README.md
@@ -0,0 +1,6 @@
+XBMC Versioncheck
+=========================
+
+This service checks the installed XBMC version against the next available one and notifies you if there is a new version available.
+When a new version comes out the versions.txt should be updated to reflect the latest version available.
+When updating the version.txt always put latest release at the top since the list is read in chronilogical order. \ No newline at end of file
diff --git a/addons/service.xbmc.versioncheck/addon.xml b/addons/service.xbmc.versioncheck/addon.xml
new file mode 100644
index 0000000000..a337797c2b
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/addon.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<addon id="service.xbmc.versioncheck"
+ name="XBMC Version Check"
+ version="0.1.2"
+ provider-name="Team XBMC">
+ <requires>
+ <import addon="xbmc.addon" version="12.0.0"/>
+ <import addon="xbmc.python" version="2.1.0"/>
+ <import addon="script.module.simplejson" version="2.0.10"/>
+ </requires>
+ <extension point="xbmc.service" library="service.py" start="login"/>
+ <extension point="xbmc.addon.metadata">
+ <summary lang="en">XBMC Version Check checks if you are running latest released version.</summary>
+ <description lang="en">XBMC Version Check only supports a number of platforms/distros as releases may deffer between them. For more information visit the xbmc.org website.</description>
+ <disclaimer lang="en">Feel free to use this script. For information visit xbmc.org</disclaimer>
+ <license>GNU GENERAL PUBLIC LICENSE. Version 2, June 1991</license>
+ <platform>osx osx32 osx64 ios windx wingl linux</platform>
+ <website>http://xbmc.org</website>
+ <source>https://github.com/XBMC-Addons/service.xbmc.versioncheck</source>
+ <forum>http://forum.xbmc.org/showthread.php?tid=160228</forum>
+ <email></email>
+ </extension>
+</addon>
diff --git a/addons/service.xbmc.versioncheck/changelog.txt b/addons/service.xbmc.versioncheck/changelog.txt
new file mode 100644
index 0000000000..be117b0a3e
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/changelog.txt
@@ -0,0 +1,5 @@
+v0.1.2
+- Add notification for Ubuntu users checking through apt command
+
+v0.1.1
+- Initial version \ No newline at end of file
diff --git a/addons/service.xbmc.versioncheck/icon.png b/addons/service.xbmc.versioncheck/icon.png
new file mode 100644
index 0000000000..a7ad3ebb84
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/icon.png
Binary files differ
diff --git a/addons/service.xbmc.versioncheck/resources/language/English/strings.po b/addons/service.xbmc.versioncheck/resources/language/English/strings.po
new file mode 100644
index 0000000000..38b4c9a7e3
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/resources/language/English/strings.po
@@ -0,0 +1,69 @@
+# XBMC Media Center language file
+# Addon Name: XBMC Version Check
+# Addon id: service.xbmc.versioncheck
+# Addon Provider: Team XBMC
+msgid ""
+msgstr ""
+"Project-Id-Version: XBMC Addons\n"
+"Report-Msgid-Bugs-To: alanwww1@xbmc.org\n"
+"POT-Creation-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: XBMC Translation Team\n"
+"Language-Team: English (http://www.transifex.com/projects/p/xbmc-addons/language/en/)\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Language: en\n"
+"Plural-Forms: nplurals=2; plural=(n != 1);\n"
+
+msgctxt "#32001"
+msgid "We would like to recommend you to upgrade."
+msgstr ""
+
+msgctxt "#32002"
+msgid "Visit XBMC.org for more information."
+msgstr ""
+
+msgctxt "#32003"
+msgid "You are still using an older stable version of XBMC."
+msgstr ""
+
+msgctxt "#32004"
+msgid "You are still using an older RC version of XBMC."
+msgstr ""
+
+msgctxt "#32005"
+msgid "You are still using an older beta version of XBMC."
+msgstr ""
+
+msgctxt "#32006"
+msgid "You are still using an older alpha version of XBMC."
+msgstr ""
+
+msgctxt "#32007"
+msgid "You are still using an older monthly version of XBMC."
+msgstr ""
+
+msgctxt "#32008"
+msgid "You are still using an older non stable version of XBMC."
+msgstr ""
+
+msgctxt "#32009"
+msgid "Would you like to remove this reminder?"
+msgstr ""
+
+msgctxt "#32010"
+msgid "You can enable/disable it through addon settings."
+msgstr ""
+
+msgctxt "#32011"
+msgid "Use your package manager(apt) to upgrade."
+msgstr ""
+
+msgctxt "#32020"
+msgid "General"
+msgstr ""
+
+msgctxt "#32021"
+msgid "Enable XBMC version check?"
+msgstr "" \ No newline at end of file
diff --git a/addons/service.xbmc.versioncheck/resources/settings.xml b/addons/service.xbmc.versioncheck/resources/settings.xml
new file mode 100644
index 0000000000..f4efe60348
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/resources/settings.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<settings>
+ <category label="32020">
+ <setting label="32021" type="bool" id="versioncheck_enable" default="true"/>
+ </category>
+</settings>
diff --git a/addons/service.xbmc.versioncheck/resources/versions.txt b/addons/service.xbmc.versioncheck/resources/versions.txt
new file mode 100644
index 0000000000..0ababef907
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/resources/versions.txt
@@ -0,0 +1,190 @@
+{
+ "jsonrpc": "2.0",
+ "releases": {
+ "stable": [
+ {
+ "major": "12",
+ "minor": "1",
+ "tag": "stable",
+ "revision": "20130317-0d373cc",
+ "extrainfo": "final"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "stable",
+ "revision": "20130127-fb595f2",
+ "extrainfo": "final"
+ },
+ {
+ "major": "11",
+ "minor": "0",
+ "tag": "stable",
+ "revision": "20120321-14feb09",
+ "extrainfo": "final"
+ },
+ {
+ "major": "10",
+ "minor": "1",
+ "tag": "stable",
+ "revision": "",
+ "extrainfo": "final"
+ },
+ {
+ "major": "10",
+ "minor": "0",
+ "tag": "stable",
+ "revision": "",
+ "extrainfo": "final"
+ }
+ ],
+ "releasecandidate": [
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "releasecandidate",
+ "revision": "20130127-fb595f2",
+ "extrainfo": "RC3"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "releasecandidate",
+ "revision": "20121219-74b907c",
+ "extrainfo": "RC2"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "releasecandidate",
+ "revision": "20121210-baaa51c",
+ "extrainfo": "RC1"
+ },
+ {
+ "major": "11",
+ "minor": "0",
+ "tag": "releasecandidate",
+ "revision": "20120229-f38655f",
+ "extrainfo": "RC2"
+ },
+ {
+ "major": "11",
+ "minor": "0",
+ "tag": "releasecandidate",
+ "revision": "20120226-30312f1",
+ "extrainfo": "RC1"
+ }
+ ],
+ "beta": [
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20121210-baaa51c",
+ "extrainfo": "beta3"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20121201-192701b",
+ "extrainfo": "beta2"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20121116-f7dc858",
+ "extrainfo": "beta1-repack"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20121114-25bb46a",
+ "extrainfo": "beta1"
+ },
+ {
+ "major": "11",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20120207-1fef727",
+ "extrainfo": "beta3"
+ } ,
+ {
+ "major": "11",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20120120-f76c547",
+ "extrainfo": "beta2"
+ },
+ {
+ "major": "11",
+ "minor": "0",
+ "tag": "beta",
+ "revision": "20111222-22ad8e4",
+ "extrainfo": "beta1"
+ }
+ ],
+ "alpha": [
+ ],
+ "prealpha": [
+ {
+ "major": "13",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20130227-8d2e0fe",
+ "extrainfo": "alpha1"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20121102-e292b11",
+ "extrainfo": "alpha7"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20121001-f4d8117",
+ "extrainfo": "alpha6"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20120831-12840c2",
+ "extrainfo": "alpha5"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20120801-e4443f2",
+ "extrainfo": "alpha4"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20120701-37fc72c",
+ "extrainfo": "alpha3"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20120531-1495cbe",
+ "extrainfo": "alpha2"
+ },
+ {
+ "major": "12",
+ "minor": "0",
+ "tag": "prealpha",
+ "revision": "20120430-4505d08",
+ "extrainfo": "alpha1"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/addons/service.xbmc.versioncheck/service.py b/addons/service.xbmc.versioncheck/service.py
new file mode 100644
index 0000000000..49acf3a6ab
--- /dev/null
+++ b/addons/service.xbmc.versioncheck/service.py
@@ -0,0 +1,253 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013 Team-XBMC
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+
+import os
+import platform
+import xbmc
+import xbmcaddon
+import xbmcgui
+import xbmcvfs
+
+if sys.version_info < (2, 7):
+ import simplejson
+else:
+ import json as simplejson
+
+__addon__ = xbmcaddon.Addon()
+__addonversion__ = __addon__.getAddonInfo('version')
+__addonname__ = __addon__.getAddonInfo('name')
+__addonpath__ = __addon__.getAddonInfo('path').decode('utf-8')
+__icon__ = __addon__.getAddonInfo('icon')
+__localize__ = __addon__.getLocalizedString
+
+def log(txt):
+ if isinstance (txt,str):
+ txt = txt.decode("utf-8")
+ message = u'%s: %s' % (__addonname__, txt)
+ xbmc.log(msg=message.encode("utf-8"), level=xbmc.LOGDEBUG)
+
+class Main:
+ def __init__(self):
+ if __addon__.getSetting("versioncheck_enable") == 'true' and not xbmc.getCondVisibility('System.HasAddon(os.openelec.tv)'):
+ if not sys.argv[0]:
+ xbmc.executebuiltin('XBMC.AlarmClock(CheckAtBoot,XBMC.RunScript(service.xbmc.versioncheck, started),00:00:30,silent)')
+ xbmc.executebuiltin('XBMC.AlarmClock(CheckWhileRunning,XBMC.RunScript(service.xbmc.versioncheck, started),24:00:00,silent,loop)')
+ elif sys.argv[0] and sys.argv[1] == 'started':
+ if xbmc.getCondVisibility('System.Platform.Linux'):
+ oldversion = _versionchecklinux('xbmc')
+ else:
+ oldversion = _versioncheck()
+ if oldversion[0]:
+ _upgrademessage(oldversion[1])
+ else:
+ pass
+
+def _versioncheck():
+ # initial vars
+ oldversion = False
+ msg = ''
+ # retrieve versionlists from supplied version file
+ version_file = os.path.join(__addonpath__, 'resources/versions.txt')
+ # Eden didn't have xbmcvfs.File()
+ if xbmcaddon.Addon('xbmc.addon').getAddonInfo('version') < "11.9.3":
+ file = open(version_file, 'r')
+ else:
+ file = xbmcvfs.File(version_file)
+ data = file.read()
+ file.close()
+ version_query = unicode(data, 'utf-8', errors='ignore')
+ version_query = simplejson.loads(version_query)
+
+ # Create seperate version lists
+ versionlist_stable = version_query['releases']['stable']
+ versionlist_rc = version_query['releases']['releasecandidate']
+ versionlist_beta = version_query['releases']['beta']
+ versionlist_alpha = version_query['releases']['alpha']
+ versionlist_prealpha = version_query['releases']['prealpha']
+
+ # retrieve current installed version
+ json_query = xbmc.executeJSONRPC('{ "jsonrpc": "2.0", "method": "Application.GetProperties", "params": {"properties": ["version", "name"]}, "id": 1 }')
+ json_query = unicode(json_query, 'utf-8', errors='ignore')
+ json_query = simplejson.loads(json_query)
+ version_installed = []
+ if json_query.has_key('result') and json_query['result'].has_key('version'):
+ version_installed = json_query['result']['version']
+ log("Version installed %s" %version_installed)
+ # set oldversion flag to false
+ oldversion = False
+
+ ### Check to upgrade to newest available stable version
+ # check on smaller major version. Smaller version than available always notify
+ if version_installed['major'] < int(versionlist_stable[0]['major']):
+ msg = __localize__(32003)
+ oldversion = True
+ log("Version available %s" %versionlist_stable[0])
+
+ # check on same major version installed and available
+ elif version_installed['major'] == int(versionlist_stable[0]['major']):
+ # check on smaller minor version
+ if version_installed['minor'] < int(versionlist_stable[0]['minor']):
+ msg = __localize__(32003)
+ oldversion = True
+ log("Version available %s" %versionlist_stable[0])
+ # check if not installed a stable so always notify
+ elif version_installed['tag'] != "stable":
+ msg = __localize__(32008)
+ oldversion = True
+ log("Version available %s" %versionlist_stable[0])
+ else:
+ log("Last available stable installed")
+
+ ### Check to upgrade to newest available RC version if not installed stable
+ ## Check also oldversion hasn't been set true by previous check because if so this need to be skipped
+ if not oldversion and version_installed['tag'] != "stable":
+ # only check on equal or lower major because newer installed beta/alpha/prealpha version will be higher
+ if versionlist_rc and version_installed['major'] <= int(versionlist_rc[0]['major']):
+ if version_installed['revision'] <= versionlist_rc[0]['revision']:
+ msg = __localize__(32004)
+ oldversion = True
+ log("Version available %s" %versionlist_rc[0])
+
+ # exclude if installed RC on checking for newer beta
+ if not oldversion and versionlist_beta and version_installed['tag'] not in ["releasecandidate"]:
+ if version_installed['major'] <= int(versionlist_beta[0]['major']):
+ if version_installed['revision'] < versionlist_beta[0]['revision']:
+ msg = __localize__(32005)
+ oldversion = True
+ log("Version available %s" %versionlist_beta[0])
+
+ # exclude if installed RC or beta on checking for newer alpha
+ if not oldversion and versionlist_alpha and version_installed['tag'] not in ["releasecandidate", "beta"]:
+ if version_installed['major'] <= int(versionlist_alpha[0]['major']):
+ if version_installed['revision'] < versionlist_alpha[0]['revision']:
+ msg = __localize__(32006)
+ oldversion = True
+ log("Version available %s" %versionlist_alpha[0])
+
+ # exclude if installed RC, beta or alpha on checking for newer prealpha
+ if not oldversion and versionlist_prealpha and version_installed['tag'] not in ["releasecandidate", "beta", "alpha"]:
+ if version_installed['major'] <= int(versionlist_prealpha[0]['major']):
+ if version_installed['revision'] < versionlist_prealpha[0]['revision']:
+ msg = __localize__(32007)
+ oldversion = True
+ log("Version available %s" %versionlist_prealpha[0])
+
+ # Nothing to see here, move along
+ else:
+ # Nothing to see here, move along
+ pass
+ return oldversion, msg
+
+
+def _versionchecklinux(package):
+ if (platform.dist()[0] == "Ubuntu" or platform.dist()[0] == "Debian"):
+ oldversion, msg = _versioncheckapt(package)
+ else:
+ log("Unsupported platform %s" %platform.dist()[0])
+ sys.exit(0)
+ return oldversion, msg
+
+def _versioncheckapt(package):
+ #check for linux using Apt
+ # initial vars
+ oldversion = False
+ msg = ''
+ result = ''
+
+ # try to import apt
+ try:
+ import apt
+ from aptdaemon import client
+ from aptdaemon import errors
+ except:
+ log('python apt import error')
+ sys.exit(0)
+ apt_client = client.AptClient()
+ try:
+ result = apt_client.update_cache(wait=True)
+ if (result == "exit-success"):
+ log("Finished updating the cache")
+ else:
+ log("Error updating the cache %s" %result)
+ except errors.NotAuthorizedError:
+ log("You are not allowed to update the cache")
+ sys.exit(0)
+
+ trans = apt_client.upgrade_packages([package])
+ trans.simulate(reply_handler=_apttransstarted, error_handler=_apterrorhandler)
+ pkg = trans.packages[4][0]
+ if (pkg == package):
+ cache=apt.Cache()
+ cache.open(None)
+ cache.upgrade()
+ if (cache[package].installed and cache[package].installed.version != cache[package].candidate.version):
+ log("Version installed %s" %cache[package].installed.version)
+ log("Version available %s" %cache[package].candidate.version)
+ oldversion = True
+ msg = __localize__(32011)
+ elif (cache[package].installed):
+ log("Already on newest version %s" %cache[package].installed.version)
+ else:
+ log("No installed package found, probably manual install")
+ sys.exit(0)
+
+ return oldversion, msg
+
+def _apttransstarted():
+ pass
+
+def _apterrorhandler(error):
+ raise error
+
+def _upgrademessage(msg):
+ # Don't show while watching a video
+ while(xbmc.Player().isPlayingVideo() and not xbmc.abortRequested):
+ xbmc.sleep(1000)
+ i = 0
+ while(i < 5 and not xbmc.abortRequested):
+ xbmc.sleep(1000)
+ i += 1
+ # Detect if it's first run and only show OK dialog + ask to disable on that
+ firstrun = __addon__.getSetting("versioncheck_firstrun") != 'false'
+ if firstrun and not xbmc.abortRequested:
+ xbmcgui.Dialog().ok(__addonname__,
+ msg,
+ __localize__(32001),
+ __localize__(32002))
+ # sets check to false which is checked on startup
+ if xbmcgui.Dialog().yesno(__addonname__,
+ __localize__(32009),
+ __localize__(32010)):
+ __addon__.setSetting("versioncheck_enable", 'false')
+ # set first run to false to only show a popup next startup / every two days
+ __addon__.setSetting("versioncheck_firstrun", 'false')
+ # Show notification after firstrun
+ elif not xbmc.abortRequested:
+ log(__localize__(32001) + '' + __localize__(32002))
+ xbmc.executebuiltin("XBMC.Notification(%s, %s, %d, %s)" %(__addonname__,
+ __localize__(32001) + '' + __localize__(32002),
+ 15000,
+ __icon__))
+ else:
+ pass
+
+if (__name__ == "__main__"):
+ log('Version %s started' % __addonversion__)
+ Main()