Created
April 1, 2016 21:16
-
-
Save pefoley2/db9400f1bde89382ee8417abc27988fb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
#!/usr/bin/python3 | |
# -*- coding: utf-8 -*- | |
import os | |
import re | |
from glob import glob | |
from requests import head | |
def main(): | |
url = 'https://plex.tv/downloads/latest/1' | |
url = head( | |
url, | |
params={ | |
'channel': '8', | |
'build': 'linux-ubuntu-x86_64', | |
'distro': 'ubuntu', | |
'X-Plex-Token': '<redacted>'}, | |
allow_redirects=True).url | |
match = re.search(r'plexmediaserver_([\d|.]+)-([\da-f]+)_amd64.deb', url) | |
path = '/usr/overlay/media-tv/plex-media-server/' | |
old = glob(path + '*.ebuild')[0] | |
new = re.sub(r'[\d|.]+(?<!\.)', match.group(1), old) | |
if old == new: | |
return | |
print("New plex version: %s" % match.group(1)) | |
input_lines = None | |
with open(old, 'r') as infile: | |
input_lines = infile.readlines() | |
with open(new, 'w') as output: | |
for line in input_lines: | |
if re.match('MY_REV', line): | |
output.write('MY_REV="%s"\n' % match.group(2)) | |
else: | |
output.write(line) | |
os.remove(old) | |
if __name__ == '__main__': | |
main() |
This file contains hidden or 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
# Copyright 1999-2016 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Id$ | |
EAPI=5 | |
inherit unpacker user | |
DESCRIPTION="PLEX media server" | |
HOMEPAGE="https://plex.tv/" | |
MY_PN="plexmediaserver" | |
MY_REV="cece46d" | |
SRC_URI="http://downloads.plexapp.com/${PN}/${PV}-${MY_REV}/${MY_PN}_${PV}-${MY_REV}_amd64.deb | |
https://nightlies.plexapp.com/directdl/plex-media-server/dist-ninja/${PV}-${MY_REV}/plexmediaserver_${PV}-${MY_REV}_amd64.deb" | |
LICENSE="GPL-2 LGPL-2" | |
SLOT="0" | |
KEYWORDS="~x86 ~amd64" | |
IUSE="" | |
RDEPEND="net-dns/avahi" | |
QA_PRESTRIPPED=" | |
usr/lib/plexmediaserver/Plex.Media.Server | |
usr/lib/plexmediaserver/Plex.DLNA.Server | |
usr/lib/plexmediaserver/Plex.Media.Scanner | |
usr/lib/plexmediaserver/Resources/Plex.New.Transcoder | |
usr/lib/plexmediaserver/Resources/Plex.Transcoder | |
usr/lib/plexmediaserver/libavutil.so.54 | |
usr/lib/plexmediaserver/libavcodec.so.56 | |
usr/lib/plexmediaserver/libavformat.so.56 | |
usr/lib/plexmediaserver/libswscale.so.3" | |
QA_EXECSTACK="usr/lib/plexmediaserver/libgnsdk_dsp.so.3.07.7" | |
WQA_TEXTRELS="usr/lib/plexmediaserver/libavcodec.so.54 | |
usr/lib/plexmediaserver/libavutil.so.52 | |
usr/lib/plexmediaserver/libavformat.so.54 | |
usr/lib/plexmediaserver/libswscale.so.2" | |
S="${WORKDIR}" | |
src_prepare(){ | |
#ubuntu's trash | |
rm -rf etc/apt | |
rm etc/init.d/plexmediaserver | |
#fdo | |
sed 's|Audio;Music;Video;Player;Media;|AudioVideo;Player;|;s|x-www-browser|xdg-open|' \ | |
-i usr/share/applications/plexmediamanager.desktop | |
} | |
src_install(){ | |
cp -R {usr,etc} "${D}" | |
#port for openrc | |
doinitd "${FILESDIR}/pms" | |
} | |
pkg_preinst() { | |
enewgroup plex | |
enewuser plex -1 /bin/bash /var/lib/plexmediaserver plex | |
} |
This file contains hidden or 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
#!/sbin/runscript | |
# Copyright 1999-2014 Gentoo Foundation | |
# Distributed under the terms of the GNU General Public License v2 | |
# $Header: $ | |
PIDFILE="/var/run/pms.pid" | |
depend() { | |
need localmount | |
after net | |
keyword -timeout | |
} | |
start() { | |
ebegin "Starting plex-media-server" | |
. /etc/default/plexmediaserver | |
start-stop-daemon --start -b -x /usr/sbin/start_pms -u $PLEX_MEDIA_SERVER_USER --make-pidfile --pidfile "${PIDFILE}" | |
eend $? | |
} | |
stop() { | |
ebegin "Stopping plex-media-server" | |
start-stop-daemon --stop -x /usr/sbin/start_pms --pidfile "${PIDFILE}" | |
killall -g start_pms | |
eend $? | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment