]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
python: Update to allow tvhmeta to run in dev or in live.
authorE.Smith <31170571+azlm8t@users.noreply.github.com>
Thu, 27 Sep 2018 12:21:01 +0000 (13:21 +0100)
committerperexg <perex@perex.cz>
Tue, 2 Oct 2018 14:05:03 +0000 (16:05 +0200)
In development tree, the libraries are in ../lib/py. In live,
we currently install the library in the same directory so
need to import it differently.

support/tvhmeta

index 53dfd8b8f2513edd9c2061dd00f8c40cb67c62be..78f796548c8b5ab97f15f642312d9ce5d89e69a3 100755 (executable)
@@ -50,8 +50,15 @@ except:
 import json
 import sys
 import os
+# In development tree, the library is in ../lib/py, but in live it's
+# in the install bin directory (since it is an executable in its own
+# right)
 sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', 'lib', 'py'))
-import tvh.tv_meta_tmdb as tv_meta_tmdb
+try:
+  import tvh.tv_meta_tmdb as tv_meta_tmdb
+except:
+  sys.path.insert(0, os.path.join(os.path.dirname(__file__), '.'))
+  import tv_meta_tmdb as tv_meta_tmdb
 
 class TvhMeta(object):
   def __init__(self, host, port, user, password):