(self, li_s, row_count)
| 112 | self._makeItem(lis, row_count) |
| 113 | |
| 114 | def _makeItem(self, li_s, row_count): |
| 115 | li_s = self.splist(li_s, 5) |
| 116 | for row, lis in enumerate(li_s): |
| 117 | for col, li in enumerate(lis): |
| 118 | a = li.find('.//div/a') |
| 119 | play_url = "https://music.163.com" + a.get("href") # 歌单播放地址 |
| 120 | img = li.find(".//div/img") |
| 121 | cover_url = img.get("src") # 封面图片 |
| 122 | playlist_title = a.get("title") # 歌单名 |
| 123 | # 歌手 |
| 124 | author_info = li.xpath(".//p[2]/a")[0] |
| 125 | playlist_author = "<span style=\"font-size: 12px;\"作者:{}</span>".format( |
| 126 | Actor.format(href="https://music.163.com" + |
| 127 | author_info.get("href"), |
| 128 | title=author_info.get("title"))) |
| 129 | # 播放数 |
| 130 | play_count = (li.xpath(".//div/div/span[2]/text()") or [""])[0] |
| 131 | path = "cache/{0}.jpg".format( |
| 132 | os.path.splitext( |
| 133 | os.path.basename(cover_url).split('?')[0])[0]) |
| 134 | cover_path = "Data/pic_v.png" |
| 135 | if os.path.isfile(path): |
| 136 | cover_path = path |
| 137 | |
| 138 | # print(cover_path, playlist_title, |
| 139 | # playlist_author, play_count, play_url, cover_url, path) |
| 140 | iwidget = CoverItemWidget(self, manager=self._manager) |
| 141 | iwidget.init(cover_path, playlist_title, playlist_author, |
| 142 | play_count, play_url, cover_url, path) |
| 143 | self._layout.addWidget(iwidget, row_count + row, col) |
| 144 | |
| 145 | |
| 146 | class Window(QScrollArea): |
no test coverage detected