爱意满满的作品展示区。
Natsumoku

生成自己的豆瓣电影/音乐/图书封面墙

  •  
  •   Natsumoku · Jan 3, 2022 · 5450 views
    This topic created in 1771 days ago, the information mentioned may be changed or developed.

    简介

    以前豆瓣电影的个人年终总结会在电脑网页端生成海报墙,现在那个功能被砍了,只能在手机端查看,而且那幅图也不会再更新。

    所以我写了这个脚本,按照自己需求,可以随时用自己观影的最新数据,生成横版 /竖版的海报墙,大图的穿插可以自己调节。默认是按照给星的高低、从近往远排列的,也可以进行筛选。

    效果图

    建议新标签页查看大图。原本我还想做图片尾端渐变到透明的效果,但是那样的话一张 PNG 格式的成品图轻松超过 15MB ,所以还是放弃了。

    电影海报墙: Preview1

    专辑封面墙: Preview2

    使用方式

    见 GitHub,README 里有参数说明。

    24 replies  •  2023-09-14 20:59:52 +08:00
    jr55475f112iz2tu
    jr55475f112iz2tu
    Jan 3, 2022
    1
    好像看到不少后摇专辑
    时过夏末 好评
    Natsumoku
    Natsumoku
    OP
    Jan 3, 2022 via Android❤️1
    2
    @czfy 是的,后摇治愈又致郁
    d5
    d5
    Jan 3, 2022❤️1
    3
    哈哈有意思,非常酷,已经 start+fork 支持!
    wellsc
    wellsc
    Jan 3, 2022
    4
    可读性太差,没啥意义
    theHaagenDazs
    theHaagenDazs
    Jan 3, 2022
    5
    看着不错!这种图本来也就是图个好看,已经 star 了
    Natsumoku
    Natsumoku
    OP
    Jan 4, 2022
    6
    做了个改动,现在如果在参数中设成**按标记顺序排列**,被标为五星的条目会优先占据大图位置(也就是说它们会稍稍脱离原本的顺序,为了显得更突出)。
    oluoluo
    oluoluo
    Jan 4, 2022
    7
    Traceback (most recent call last):
    File "image_wall.py", line 9, in <module>
    from item import Item, get_next_img_url
    File "/root/dl/DoubanImageWall/item.py", line 17, in <module>
    def get_next_img_url(items: list[Item], sort_by_time: bool, need_large_img: bool) -> str:
    TypeError: 'type' object is not subscriptable
    oluoluo
    oluoluo
    Jan 4, 2022
    8
    这个是为什么啊
    dragonPunch
    dragonPunch
    Jan 4, 2022
    9
    音乐专辑墙的竹内玛利亚、杏里,还有角松敏生大好评!!
    mortal
    mortal
    Jan 4, 2022
    10
    LZ cache 文件夹不加 .gitignore 么😂
    Natsumoku
    Natsumoku
    OP
    Jan 4, 2022
    11
    @oluoluo 你是 python 3.9 之后的版本吗?如果不是的话,试试看索性删掉 17 行的 “: list[Item]”
    (查了一下,感觉是这个问题: https://stackoverflow.com/questions/63460126/typeerror-type-object-is-not-subscriptable-in-a-function-signature )
    Natsumoku
    Natsumoku
    OP
    Jan 4, 2022
    12
    @mortal 这是个好问题。直觉上应该加的,但是我觉得加了的话,GitHub Actions 每天定时跑的时候,cache 文件夹是不是就形同虚设了?本地跑肯定没问题,不手动清空就行,但我不知道 GitHub Actions 机器是怎么分配的,ignore 掉以后大概每次跑之前 cache 都是空的?
    Natsumoku
    Natsumoku
    OP
    Jan 4, 2022
    13
    @oluoluo 如果是 python 3.7 (包括)之后的话,可以 pull 一下重跑试试看,我刚才加了个 from __future__ import annotations 应该能解决那个报错
    WeitingChen
    WeitingChen
    Jan 4, 2022
    14
    点击相关图片,会跳转链接吗
    Natsumoku
    Natsumoku
    OP
    Jan 4, 2022 via Android
    15
    @WeitingChen 生成的是 jpg 格式,所以不会。如果想达到那个效果得用 HTML 和 js 了
    daolanfler
    daolanfler
    Jan 4, 2022 via iPhone
    16
    有点像 mac apple music 锁屏
    oluoluo
    oluoluo
    Jan 4, 2022
    17
    @Natsumoku 确实是 python 版本的问题,哈哈,对新特性的语法不太熟悉。。。
    Rebron1900
    Rebron1900
    Jan 4, 2022
    18
    可以搞个 html 和 js 的么,想挂在博客上面
    terencehan
    terencehan
    Jan 4, 2022
    19
    python 3.7.4

    ```
    Traceback (most recent call last):
    File "image_wall.py", line 90, in <module>
    rating = int(re.match(rating_span_regex, item_div.find('span', {'class': rating_span_regex})['class'][0])[1])
    TypeError: 'NoneType' object is not subscriptable
    ```
    Natsumoku
    Natsumoku
    OP
    Jan 4, 2022
    20
    @terencehan 感谢反馈,这是没有打星的条目会触发这个问题,目前已修复
    WeitingChen
    WeitingChen
    Jan 5, 2022
    21
    @Natsumoku 可以搞成 canvas
    gnomeek
    gnomeek
    Jan 15, 2022
    22
    CyberZCS
    CyberZCS
    Apr 22, 2022
    23
    有意思,感谢分享
    ldsj
    ldsj
    Sep 14, 2023
    24
    赞
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   1785 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 47ms · UTC 15:54 · PVG 23:54 · LAX 07:54 · JFK 10:54
    ♥ Do have faith in what you're doing.