Skip to content

Commit

Permalink
Merge pull request #33 from ManiMatter/21-feature-request-readarr-sup…
Browse files Browse the repository at this point in the history
…port

Showing Git package Version in loading message
  • Loading branch information
ManiMatter authored Feb 18, 2024
2 parents 845942f + e819f48 commit 8f98e22
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,6 @@ jobs:
IMAGE_NAME: ghcr.io/manimatter/decluttarr
IMAGE_TAG: ${{ steps.setversion.outputs.new_tag }}
run: |
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest -f docker/Dockerfile --push .
docker buildx build --platform linux/amd64,linux/arm64 -t $IMAGE_NAME:$IMAGE_TAG -t $IMAGE_NAME:latest --label com.decluttarr.version=$IMAGE_TAG -f docker/Dockerfile --push .
19 changes: 18 additions & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import requests
import platform
from packaging import version


########### Enabling Logging
# Set up logging
log_level_num=logging.getLevelName(settings_dict['LOG_LEVEL'])
Expand Down Expand Up @@ -58,7 +60,9 @@ async def main():
# Print Settings
fmt = '{0.days} days {0.hours} hours {0.minutes} minutes'
logger.info('#' * 50)
logger.info('Application Started!')
logger.info('Decluttarr - Application Started!')
if settings_dict['IS_IN_DOCKER']:
logger.info('Version: %s', get_image_tag())
logger.info('')
logger.info('*** Current Settings ***')
logger.info('%s | Removing failed downloads', str(settings_dict['REMOVE_FAILED']))
Expand Down Expand Up @@ -216,3 +220,16 @@ async def main():
download_sizes_tracker = Download_Sizes_Tracker({})
asyncio.run(main())


import docker
def get_image_tag():
client = docker.from_env()

try:
container_info = client.containers.get('decluttarr')
image_tag = container_info.labels.get('decluttarr.version', 'No image tag provided')
return image_tag
except docker.errors.NotFound:
return 'Container not found'
except Exception as e:
return f'Error retrieving image tag: {e}'

0 comments on commit 8f98e22

Please sign in to comment.