rr- / szurubooru

Image board engine, Danbooru-style.
GNU General Public License v3.0
703 stars 177 forks source link

Feature Request: Implement file created/last modified date (different from creation date) #340

Closed skybldev closed 2 years ago

skybldev commented 4 years ago

Hi. I'm using szurubooru as an archive for family photos, because of the intuitive web interface and the core tag-based mechanics that make it easy to search pictures. However, there is no way to set the creation date of a file, which is probably something carried on from the first booru software.

Therefore, as an innovative feature, there shouldn't just be a creation date (aka post creation), but also a file creation date. That way, one can truly sort chronologically by date created (or taken), as opposed to chronologically by date added. This is probably not in the tradition of boorus being used just as an aggregator of digital art, where creation date doesn't matter as much as posted date.

In order not to mess up the current API, creation_date will be left alone, but the new attribute will be file_creation_date in order to differentiate. In the web interface, the new attribute will be under the text "File created [x days ago]"

I am willing to contribute for this, do I get started in model/post.py?

noirscape commented 4 years ago

One way public boorus tend to solve this issue is by creating date/month/year tags. Perhaps that could be a solution?

On Mon, 3 Aug 2020 at 20:08, L5474 notifications@github.com wrote:

Hi. I'm using szurubooru as an archive for family photos, because of the intuitive web interface and the core tag-based mechanics that make it easy to search pictures. However, there is no way to set the creation date of a file, which is probably something carried on from the first booru software.

Therefore, as an innovative feature, there shouldn't just be a creation date (aka post creation), but also a file creation date. That way, one can truly sort chronologically by date created (or taken), as opposed to chronologically by date added. This is probably not in the tradition of boorus being used just as an aggregator of digital art, where creation date doesn't matter as much as posted date.

In order not to mess up the current API, creation_date will be left alone, but the new attribute will be file_creation_date in order to differentiate. In the web interface, the new attribute will be under the text "File created [x days ago]"

I am willing to contribute for this, do I get started in model/post.py?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rr-/szurubooru/issues/340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGPVKMKRTLXOHTOF4P5SZDR634JHANCNFSM4PTSW3ZQ .

skybldev commented 4 years ago

That seems like more of a half-baked solution, and I can say the exact same thing for all boorus I’ve visited. They either forget the year or only put the year. And most importantly, you cannot sort it by that type of tag.

Again,

That way, one can truly sort chronologically by date created (or taken), as opposed to chronologically by date added.

If this is truly not in the spirit of boorus then I will just implement it in a personal fork and leave this as-is. However I believe this will be beneficial to many users, which is also part of the reason I proposed those backwards-compatible naming schemes for the new attribute.

sent from my e-mail

From: Valentijnmailto:notifications@github.com Sent: Monday, August 3, 2020 03:38 PM To: rr-/szuruboorumailto:szurubooru@noreply.github.com Cc: L5474mailto:skybluehexapon@outlook.com; Authormailto:author@noreply.github.com Subject: Re: [rr-/szurubooru] [Feature Request] Implement created date (diffrent from creation date) (#340)

One way public boorus tend to solve this issue is by creating date/month/year tags. Perhaps that could be a solution?

On Mon, 3 Aug 2020 at 20:08, L5474 notifications@github.com wrote:

Hi. I'm using szurubooru as an archive for family photos, because of the intuitive web interface and the core tag-based mechanics that make it easy to search pictures. However, there is no way to set the creation date of a file, which is probably something carried on from the first booru software.

Therefore, as an innovative feature, there shouldn't just be a creation date (aka post creation), but also a file creation date. That way, one can truly sort chronologically by date created (or taken), as opposed to chronologically by date added. This is probably not in the tradition of boorus being used just as an aggregator of digital art, where creation date doesn't matter as much as posted date.

In order not to mess up the current API, creation_date will be left alone, but the new attribute will be file_creation_date in order to differentiate. In the web interface, the new attribute will be under the text "File created [x days ago]"

I am willing to contribute for this, do I get started in model/post.py?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rr-/szurubooru/issues/340, or unsubscribe https://github.com/notifications/unsubscribe-auth/ADGPVKMKRTLXOHTOF4P5SZDR634JHANCNFSM4PTSW3ZQ .

-- Vriendelijke groet van Valentijn Vermeij

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frr-%2Fszurubooru%2Fissues%2F340%23issuecomment-668205370&data=02%7C01%7C%7Cf1b61df8f4a54ed4c50908d837e4dc93%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637320803368870376&sdata=TG4vJ76THI5N6VxRBqypEB5%2FZPKTErQwD%2BhiN79DdFM%3D&reserved=0, or unsubscribehttps://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHGKLWOJJQCVECUTCVXABX3R64G5BANCNFSM4PTSW3ZQ&data=02%7C01%7C%7Cf1b61df8f4a54ed4c50908d837e4dc93%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637320803368880373&sdata=NSaHUstqJRZP4LAYrPSRhpYOkXy%2FN0apFofYUNyHQvM%3D&reserved=0.

sgsunder commented 4 years ago

Can't you use the EXIF data from the image to get that information?

Might be an interesting idea for the post view page to display any EXIF information on the sidebar, if present.

skybldev commented 4 years ago

That is what I am planning to do. I have already been working on it, almost done with the web interface and API part of it. It reads the last modified date (not the creation date because after further research the last modified is more reliable) on the client side, since the file object already has a “lastModified” attribute. Then it is sent to the server.

One thing I am stuck on though; how should I generate an alembic migration for the database post columns? For now I manually edited the migration file to create another column in the database, but for production that’s of course not going to pass. I am still confused after reading alembic docs.

I’m a little bit delayed on development because of personal matters and other projects but I should be able to produce code for review on the 20th if all goes well.

Sent from my Mailhttps://go.microsoft.com/fwlink/?LinkId=550986 app

From: Shyam Sundermailto:notifications@github.com Sent: Thursday, August 13, 2020 10:52 AM To: rr-/szuruboorumailto:szurubooru@noreply.github.com Cc: L5474mailto:skybluehexapon@outlook.com; Authormailto:author@noreply.github.com Subject: Re: [rr-/szurubooru] [Feature Request] Implement file created/last modified date (diffrent from creation date) (#340)

Can't you use the EXIF data from the image to get that information?

Might be an interesting idea for the post view page to display any EXIF information on the sidebar, if present.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frr-%2Fszurubooru%2Fissues%2F340%23issuecomment-673525192&data=02%7C01%7C%7C98cb2dce19774e42315208d83f9873f7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637329271293058795&sdata=gQGO42TZmZC%2B0DfrAd9UY7PpWIcyv%2BBtr3u%2BNdPb%2FRk%3D&reserved=0, or unsubscribehttps://nam03.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHGKLWOU2HGMI6GXU6PBYPLSAP4ZPANCNFSM4PTSW3ZQ&data=02%7C01%7C%7C98cb2dce19774e42315208d83f9873f7%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637329271293068780&sdata=yToiHBxjXhEe6PmjKkr2K1omRLni%2BxlRsPx2eybMME8%3D&reserved=0.

sgsunder commented 4 years ago

Creating alembic migration files within Docker is kinda annoying, so I made a helper script at doc/developer-utils/create-alembic-migration.sh.

All you have to do is provide it with a brief description of your migration file (so ./alembic-migration.sh "your message here"), then you can manually edit the newly created migration file yourself.

If you plan on making a PR, please make sure to install/enable pre-commit so that the code is delinted/has a uniform style. Thanks!

skybldev commented 4 years ago

On it! Thank you for the help. Also what is pre-commit?

Get Outlook for Androidhttps://aka.ms/ghei36


From: Shyam Sunder notifications@github.com Sent: Thursday, August 13, 2020 12:47:01 PM To: rr-/szurubooru szurubooru@noreply.github.com Cc: L5474 skybluehexapon@outlook.com; Author author@noreply.github.com Subject: Re: [rr-/szurubooru] [Feature Request] Implement file created/last modified date (diffrent from creation date) (#340)

Creating alembic migration files within Docker is kinda annoying, so I made a helper script at doc/developer-utils/create-alembic-migration.sh.

All you have to do is provide it with a brief description of your migration file (so ./alembic-migration.sh "your message here"), then you can manually edit the newly created migration file yourself.

If you plan on making a PR, please make sure to install/enable pre-commit so that the code is delinted/has a uniform style. Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Frr-%2Fszurubooru%2Fissues%2F340%23issuecomment-673586853&data=02%7C01%7C%7Cdaab8f6fdb694c8b6b8308d83fa881cc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637329340243532817&sdata=1PnHm1CbeChmnb1WRvlHpj3lJ4qGCmokV3SI6yE%2FO8Q%3D&reserved=0, or unsubscribehttps://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAHGKLWNVAMG574Z2P3NISGLSAQKILANCNFSM4PTSW3ZQ&data=02%7C01%7C%7Cdaab8f6fdb694c8b6b8308d83fa881cc%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637329340243532817&sdata=arJT9%2FzDBDiI6jQ5cGQtAJZTAmCUwGRbeKR19p8BGmY%3D&reserved=0.

sgsunder commented 4 years ago

@Luxray5474 see https://pre-commit.com/#installation to install. Then cd to the repository and run pre-commit install

skybldev commented 4 years ago

@sgsunder Alright, it's crunch time, and I'm almost done with serverside. However, your script returns an error:

$ sh create-alembic-migration.sh "Create post tables"
Traceback (most recent call last):
  File "/usr/bin/alembic", line 8, in <module>
    sys.exit(main())
  File "/usr/lib/python3.8/site-packages/alembic/config.py", line 577, in main
    CommandLine(prog=prog).main(argv=argv)
  File "/usr/lib/python3.8/site-packages/alembic/config.py", line 571, in main
    self.run_cmd(cfg, options)
  File "/usr/lib/python3.8/site-packages/alembic/config.py", line 548, in run_cmd
    fn(
  File "/usr/lib/python3.8/site-packages/alembic/command.py", line 221, in revision
    scripts = [script for script in revision_context.generate_scripts()]
  File "/usr/lib/python3.8/site-packages/alembic/command.py", line 221, in <listcomp>
    scripts = [script for script in revision_context.generate_scripts()]
  File "/usr/lib/python3.8/site-packages/alembic/autogenerate/api.py", line 513, in generate_scripts
    yield self._to_script(generated_revision)
  File "/usr/lib/python3.8/site-packages/alembic/autogenerate/api.py", line 429, in _to_script
    return self.script_directory.generate_revision(
  File "/usr/lib/python3.8/site-packages/alembic/script/base.py", line 583, in generate_revision
    heads = self.revision_map.get_revisions(head)
  File "/usr/lib/python3.8/site-packages/alembic/script/revision.py", line 321, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "/usr/lib/python3.8/site-packages/alembic/script/revision.py", line 501, in _resolve_revision_number
    self._revision_map
  File "/usr/lib/python3.8/site-packages/alembic/util/langhelpers.py", line 230, in __get__
    obj.__dict__[self.__name__] = result = self.fget(obj)
  File "/usr/lib/python3.8/site-packages/alembic/script/revision.py", line 123, in _revision_map
    for revision in self._generator():
  File "/usr/lib/python3.8/site-packages/alembic/script/base.py", line 112, in _load_revisions
    script = Script._from_filename(self, vers, file_)
  File "/usr/lib/python3.8/site-packages/alembic/script/base.py", line 906, in _from_filename
    module = util.load_python_file(dir_, filename)
  File "/usr/lib/python3.8/site-packages/alembic/util/pyfiles.py", line 98, in load_python_file
    module = load_module_py(module_id, path)
  File "/usr/lib/python3.8/site-packages/alembic/util/compat.py", line 184, in load_module_py
    spec.loader.exec_module(module)
  File "<frozen importlib._bootstrap_external>", line 783, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/opt/app/szurubooru/migrations/versions/54de8acc6cef_add_default_pool_category.py", line 17, in <module>
    Base = sa.ext.declarative.declarative_base()
AttributeError: module 'sqlalchemy.ext' has no attribute 'declarative'

even though 'add_default_pool_category' is not the file I'm trying to generate. What am I doing wrong?

sgsunder commented 4 years ago

@Luxray5474 not sure what the problem is, I can't reproduce it. Try clearing the docker build cache: docker builder prune -a

skybldev commented 4 years ago

@sgsunder I will get to that soon, thank you for the help. Today I just prioritized getting the baseline done, here is the code for review in PR #343