I would like new images to be uploaded to Immich from my phone and deleted after 30 days automatically, so I was thinking about this flow:

  1. I will Sync files to the server using Syncthing

  2. I will Copy files from the Synced folder to an Immich Consume folder, (not sure how to copy only new files (maybe use created date)). Then delete images that are older than 30 days which will remove them from my phone.

  3. I will upload to Immich using Immich CLI (?) which will use the delete after upload flag.

Basically:  

(1)

Camera, Screenshots, etc =Syncthing=> SyncthingImageConsume/{Folder}

(2)

{Script on SyncthingImageConsume}

SyncthingImageConsume/{Folder} =CopyNewFiles=> ImmichConsume/{Folder}

Then delete older than 30 days.

(3)

{Script on ImmichConsume}

Upload to immich and then delete

 

would this work? and is there a better way to do it? any tips?

  • LifeBandit666@feddit.uk
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    Could Rsync help? In OMV I can Rsync shares and it will check the folder I’m syncing to and just upload new files.

    So you could Syncthing to the server folder then Rsync that folder to your Immich at xam every day, then just manually delete things from your Syncthing folder occasionally.

  • rambos@lemm.ee
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    Feels like you want a regular Immich auto upload and a custom script that deletes old images from your phone. I can’t help with that script, but maybe also I missunderstood what is your goal

    • Mir@programming.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 months ago

      More or less yes. Except that the auto upload is limited I can’t figure out why most of albums aren’t showing

  • Shimitar@feddit.it
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    Why such a mess? Either use immich with its upload or use syncthing (I use the latter).

    Immich sucks in providing folder based albums, but excells in phone photo backup and sync!

          • Shimitar@feddit.it
            link
            fedilink
            English
            arrow-up
            5
            ·
            6 months ago

            There are many.

            Personally I use both PiGallery2 (great folder view, super fast) and HomeGallery (innovative browsing approach, modern looks).

            They will both work with your existent file/folder structure and will update as you add or remove photos.

  • Esca@lemmy.one
    link
    fedilink
    English
    arrow-up
    1
    ·
    6 months ago

    I understand you. I also don’t use the auto upload feature as it’s creating more problems for me to solve than what it fixes. I already had Syncthing running anyway so I currently use that combo (except I manually sort through my photos on a semi-weekly basis before I upload it to Immich).

    If you want, I can cook up a little Python script you could stick into Cron to do all the tasks you described. I haven’t worked with the Immich CLI yet but I’m sure I can figure it out. Send me a message if you’re interested. I will probably use it myself as well.

    • Mir@programming.devOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      6 months ago

      (except I manually sort through my photos on a semi-weekly basis before I upload it to Immich).

      I think that would be a better approach if I weren’t very lazy, I think even after the initial run I could do that since I don’t take lots of pictures but I was thinking about a fire and forget sort of thing.

      If you want, I can cook up a little Python script you could stick into Cron to do all the tasks you described.

      Thank you so much, I asked ChatGPT and it generated the bat file below (since I’m using Windows) do you think this would work?

      @echo off
      REM Change directory to your photos folder
      cd /d "C:\path\to\your\photos\folder"
      
      REM Sync files to backup folder
      robocopy . "C:\path\to\your\Camera_Backup" /mir /xo
      
      REM Delete files older than 15 days
      forfiles /p "C:\path\to\your\photos\folder" /s /m *.* /d -15 /c "cmd /c if @isdir==FALSE del @file"
      
      REM Upload assets using immich cli
      immich upload "C:\path\to\your\Camera_Backup" -r -a --delete
      
      • Esca@lemmy.one
        link
        fedilink
        English
        arrow-up
        1
        ·
        edit-2
        6 months ago

        Ah, I am not familiar at all with Windows, so I honestly wouldn’t know. Does the Immich CLI even work on Windows?

        But going off by the comments and the parts I understand, I guess it could kinda work, assuming that the arguments are all correct. Although, it will try to upload all photos every time, regardless if Immich already has them or not. Which is not ideal but I believe Immich will filter out duplicated photos. But it’s worth checking if it’s indeed smart enough to do that.

        For the Immich command it will upload the files to an album called “Camera_Backup”. Not sure if that’s what you want. If not, then remove the -a flag. If you want to upload it to a specific album, then instead add ‘-A albumname’ (edit: I realize I might be wrong here. If you have multiple folders in Syncthing you’re backing up it will work differently)

  • couch1potato@lemmy.dbzer0.com
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    6 months ago

    I just set up something similar a couple weeks ago because I wanted to upload named album folders as albums into immich.

    Workflow is:

    Syncthing to sync phone folder to folder on unraid server.

    2nd syncthing instance to sync above folder to “photo albums” folder.

    Immich-go cron job runs hourly to upload photo albums folder to immich

    I used immich-go because the CLI upload with album tag kept failing and apparently it’s a common issue so… ¯\_(ツ)_/¯ immich-go worked first try.

    Now all my photos are uploaded as albums with no manual input: