Skip to content

Commit

Permalink
Format smb sharename
Browse files Browse the repository at this point in the history
  • Loading branch information
Wizmo2 committed Jan 30, 2022
1 parent 614c539 commit 7f3cb84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
11 changes: 7 additions & 4 deletions custom_components/zidoo/media_browser.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def build_item_response(player, payload):
search_type = payload["search_type"]

media_class = ITEM_TYPE_MEDIA_CLASS[search_type]
child_media_class = MEDIA_CLASS_DIRECTORY
child_media_class = None
children = None
title = ZTITLE
thumbnail = None
Expand All @@ -57,21 +57,24 @@ def build_item_response(player, payload):
if content_type is not None and content_type in ZCONTENT_ITEM_TYPE:
item_type = ZCONTENT_ITEM_TYPE[content_type]
if item_type is not None:
child_media_class = ITEM_TYPE_MEDIA_CLASS[item_type]
item_class = ITEM_TYPE_MEDIA_CLASS[item_type]
item_thumbnail = None

children.append(
BrowseMedia(
title=item["name"],
media_class=child_media_class,
media_class=item_class,
media_content_id=item["path"],
media_content_type=item_type,
can_play=True,
can_expand=child_media_class == MEDIA_CLASS_DIRECTORY,
can_expand=item_class == MEDIA_CLASS_DIRECTORY,
thumbnail=item_thumbnail,
)
)

if child_media_class is None:
child_media_class = item_class

if media_class == MEDIA_CLASS_MOVIE or media_class == MEDIA_CLASS_TV_SHOW:
result = None
if search_id == MEDIA_TYPE_MOVIE:
Expand Down
11 changes: 6 additions & 5 deletions custom_components/zidoo/zidoorc.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ def select_source(self, source):

if source in self._content_mapping:
uri = self._content_mapping[source]
# return
# return

def get_playing_info(self):
"""Gets playing information of active app.
Expand Down Expand Up @@ -749,7 +749,7 @@ def _collection_video_id(self, movie_id):
def search_movies(self, query, searchType=-1, maxCount=DEFAULT_COUNT):
"""Return video details
Parameters
movie_id: int
movie_id: int
database movie_id
searchType: int ot str
see ZVIDEO_SEARCH_TYPES
Expand Down Expand Up @@ -787,7 +787,7 @@ def search_music(self, query, searchType=0, maxCount=DEFAULT_COUNT):
elif searchType == 2:
return self._search_album(query, maxCount)
return self._search_song(query, maxCount)

def _search_song(self, query, maxCount=DEFAULT_COUNT):
"""get search list on song title
Parameters
Expand Down Expand Up @@ -923,7 +923,7 @@ def get_host_list(self, uri, host_type=1005):
response = self._req_json(
"ZidooFileControl/getHost?path={}&type={}".format(uri, host_type)
)
_LOGGER.info("zidoo host list: {}".format(response))
_LOGGER.debug("zidoo host list: {}".format(response))

return_value = {}
share_list = []
Expand All @@ -932,9 +932,10 @@ def get_host_list(self, uri, host_type=1005):
hosts = response["hosts"]
for item in hosts:
response = self.get_file_list(item.get("ip"),item.get('type'))
hostname = item.get("name").split('/')[-1]
if response is not None and response.get("status") == 200:
for share in response["filelist"]:
share["name"] = item.get("name") + "/" + share.get("name")
share["name"] = hostname + "/" + share.get("name")
share_list.append(share)
return_value["filelist"] = share_list
return return_value
Expand Down

0 comments on commit 7f3cb84

Please sign in to comment.