Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: ShellCheck

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
check:
runs-on: ubuntu-24.04

steps:
- name: Check out code
uses: actions/checkout@v4

- name: Run ShellCheck
run: bash tools/shellcheck.sh
12 changes: 12 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# JetBrains IDE
.idea/
*.iml
*.iws

*.gz
*.tar
*.zip
*.log
*.lock
~*
*.bak
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# linux-iphone-photo-sync
Automation for loading images from an iPhone under Linux
# Linux iPhone Photo Sync (LIPS)

This project provides a small Bash script that does an incremental synchronization of the photos on your iPhone to a Linux machine.

It also exports all photos from HEIC to JPEG format in a separate directory.

## Features

1. Incremental sync from iPhone photos to a local directory
2. Export of all HEIC images to JPEG
3. Fully automatic operation

## Installation

Before you can run the script, please install the following packages:

```shell
sudo apt install libimobiledevice6 libimobiledevice-utils imagemagick
```

## Running the Script

You simply run the script without any parameters.

```shell
./lips.sh
```

The script will create the following directories:

| Directory | Purpose |
|----------------------------------------|------------------------------------------------------------------|
| `~/mnt/iPhone` | Mount point for the iPhone (source from where to copy the files) |
| `<picture-dir>/iPhone/original_photos` | Directory to which the original photos are synched |
| `<picture-dir>/iPhone/exported_jpgs` | Target directory for JPGs convered from HEIC |

## Developer Information

If you want to build the project, please install the following additional packages

```shell
sudo apt install shellcheck
```

### Static Code Analysis

To run static code analysis, please execute:

```shell
tools/shellcheck.sh
```
4 changes: 4 additions & 0 deletions doc/changes/changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Changelog

* [1.0.0](changes_1.0.0.md
* )
13 changes: 13 additions & 0 deletions doc/changes/changes_1.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# Linux iPhone Photo Sync (LIPS) 1.0.0, released 2024-07-24

Code name: Foundational Photo Sync

## Summary

In this release, our focus has been on providing the main functionalities of LIPS: photo synchronization and JPEG conversion. LIPS now enables Linux users to sync images from an iPhone via USB and converts any HEIC images to the more universally supported JPEG format.

Please note that while the application has undergone thorough testing, it's always possible for unforeseen issues to arise depending on specific system configurations and usage patterns. As always, we appreciate your feedback as we strive to make LIPS a reliable tool for iPhone and Linux users.

## Features

#1: Introduced one-way photo synchronization from an iPhone to a Linux machine.
126 changes: 126 additions & 0 deletions doc/design.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
# System Design Specification - Linux iPhone Photo Sync (LIPS)

## Introduction

This document presents the design decision made in LIPSync which meet the requirements outlined in system_requirements.md.

## Structural View

### Debian Linux Dependencies Only

To ensure compatibility and mitigate dependency issues, LIPSync is designed to use only tools and libraries available on Debian 12 or derivatives like Ubuntu.

#### Required Packages
`dsn~required-packages~1`

LIPS requires the following packages. All of them are available on a vanilla Debian-based system:

| Package | Purpose |
|--------------------------|-----------------------------------|
| `libimobiledevice6` | Library to access iPhones / iPads |
| `libimobiledevice-utils` | Binaries to use iPhone functions |
| `imagemagick` | Image conversion |

Covers:

* `req~debian-linux-dependencies-only~1`

## Runtime View

## Incremental Photo Download

LIPS incorporates an incremental photo download feature. This means it skips downloading photos that already exist in the target directory. This approach optimizes the download process by avoiding unnecessary duplication and facilitating the resumption of interrupted downloads.

### RSync for DCIM Directory
`dsn~rsync-for-dcim-directory~1`

LIPS uses `rsync` to incrementally download images from the iPhones `DCIM` directory.

Covers:

* `req~incremental-photo-download~1`

### iPhone Mount
`dsn~iphone-mount~1`

LIPS mounts the iPhone via iFuse under `<home>/mnt/iPhone`.

Covers:

* `req~incremental-photo-download~1`

### Picture Directory
`dsn~picture-directory~1`

LIPS reads the user picture directory from the user config.

Covers:

* `req~incremental-photo-download~1`

### Fallback Picture Directory
`dsn~fallback-picture-directory~1`

If the picture directory is not given in the user config, LIPS falls back to `<home>/Pictures`.

Covers:

* `req~incremental-photo-download~1`

### Original Photos Directory
`dsn~original-photos-directory~1`

LIPS syncs the original content of the iPhones `DCIM` directory to `<pictures>/original_photos`.

Covers:

* `req~incremental-photo-download~1`

## JPEG Conversion

Similarly, the script is designed to incrementally convert HEIC files to JPEG. It checks if a JPEG copy of the HEIC file already exists before carrying out the conversion. If the JPEG copy exists, the conversion process is skipped. This design approach optimizes CPU usage and processing time.

### Check JPEG Existence in Target Directory
`dsn~check-jpeg-existence-in-target-directory~1`

LIPS checks if the JPEG already exists in the target directory. If it does, LIPS skips the export.

Covers:

* `req~jpeg-incremental-conversion~1`

### Convert HEIC to JPEG With ImageMagick
`dsn~convert-heic-to-jpeg-with-imagemagick~1`

LIPS uses the `convert` tool from the ImageMagick suite to convert images from HEIC to JPG.

Covers:

* `req~jpeg-incremental-conversion~1`

### Fixed JPEG Quality of 85%
`dsn~fixed-jpeg-quality-of-85-percent~1`

LIPS converts HEIC to JPEGs at a fixed quality of 85%.

Covers:

* `req~jpeg-incremental-conversion~1`

### JPEG Export Directory
`dsn~jpeg-export-directory~1`

LIPS exports JPEGs to `<pictures>/exported_jpgs`.

Covers:

* `req~jpeg-incremental-conversion~1`

### Copy Existing JPEGs
`dsn~copy-existing-jpegs~1`

LIPS uses `rsync` to copy existing JPEGs to the export directory.

Covers:

* `req~jpeg-incremental-conversion~1`
66 changes: 66 additions & 0 deletions doc/system_requirements.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Linux iPhone Photo Sync (LIPS)

## Terms and Abbreviations

###### High Efficiency Image Coding (HEIC)

The HEIC is a file format used for storing images. It provides higher image quality and compression than traditional formats like JPG. It's widely used in Apple's IOS and macOS devices but isn't universally supported on all platforms.

## Features

### Photo Synchronization
`feat~photo-synchronization~1`

LIPS does a one-way sync of images from an iPhone via USB onto a Linux machine.

Needs: req

### JPEG Conversion
`feat~jpeg-conversion~1`

LIPSync converts the downloaded HEIC images to JPEG format.

Needs: req

## High-level Requirements

### Photo Synchronization

#### Debian Linux Dependencies Only
`req~debian-linux-dependencies-only~1`

LIPS requires only tools and libraries which are available on a Debian 12 or derived (e.g. Ubuntu) system.

Covers:

* [`feat~photo-synchronization~1`](#photo-synchronization)

Needs: dsn

#### Incremental Photo Download
`req~incremental-photo-download~1`

LIPS downloads only photos that are not yet in the target directory.

Rationale:

This speeds up the download process and makes restarting after interrupted download more reliable.

Covers:

* [`feat~photo-synchronization~1`](#photo-synchronization)

Needs: dsn

### JPG Conversion

#### JPEG Incremental Conversion
`req~jpeg-incremental-conversion~1`

LIPS converts all HEIC files for which no JPEG exists into a JPEG file in a separate export directory.

Covers:

* [`feat~jpeg-conversion~1`](#jpeg-conversion)

Needs: dsn
Loading