Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deluge 2.1.1 #41

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.github/ @noam09
124 changes: 124 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
name: Build eggs

on:
push:
branches: [deluge-2.1.1]

jobs:

release:
name: Create Github Release
# if: contains(github.ref, 'tags/v')
# needs: [test]
runs-on: ubuntu-latest
steps:
- name: Create Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Deluge 2.1.1
draft: true
prerelease: false
- name: Output Release URL File
run: |
echo "${{ steps.create_release.outputs.upload_url }}" > release_url.txt
pwd
ls -alh
- name: Save Release URL File for publish
uses: actions/[email protected]
with:
name: release_url
path: release_url.txt

build:
runs-on: ubuntu-latest
needs: [release]
strategy:
# By default, GitHub will maximize the number of jobs run in parallel
# depending on the available runners on GitHub-hosted virtual machines.
# max-parallel: 8
fail-fast: false
matrix:
include:
- python-version: "3.7"
- python-version: "3.8"
- python-version: "3.9"
- python-version: "3.10"
- python-version: "3.11"
- python-version: "3.12"

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v1
- name: Load Release URL File from release job
uses: actions/[email protected]
with:
name: release_url

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Python build
run: |
echo "Python ${{ matrix.python-version }}"
python --version
PYTHON_VERSION=${{ matrix.python-version }} ./build-all.sh
ls -alh out
ls -alh out/dist

- name: Get md5sum
run: |
echo "::set-output name=FILEHASH::$(md5sum ./out/dist/Telegramer-2.1.1.3-py${{ matrix.python-version }}.egg | cut -d ' ' -f 1)"
id: filehash

# - name: Create Release
# id: create_release
# uses: actions/create-release@v1
# env:
# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# with:
# body: "**MD5:** `${{ steps.filehash.outputs.FILEHASH }}`"
# tag_name: v2.1.1
# release_name: Deluge 2.1.1
# draft: true
# prerelease: true

- name: Get Release File Name & Upload URL
id: get_release_info
run: |
pwd
ls -alh
echo ::set-output name=file_name::${REPOSITORY_NAME##*/}-${TAG_REF_NAME##*/v} # RepositoryName-v1.0.0
value=`cat release_url.txt`
echo ::set-output name=upload_url::$value
env:
TAG_REF_NAME: ${{ github.ref }}
REPOSITORY_NAME: ${{ github.repository }}

- name: Upload Release Asset
id: upload-release-asset
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
upload_url: ${{ steps.get_release_info.outputs.upload_url }}
asset_path: ./out/dist/Telegramer-2.1.1.3-py${{ matrix.python-version }}.egg
asset_name: 'Telegramer-2.1.1.3-py${{ matrix.python-version }}.egg'
asset_content_type: application/octet-stream

# - name: Upload Release Asset
# id: upload-release-asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./out/dist/Telegramer-2.1.1.3-py${{ matrix.python-version }}.egg
# asset_name: 'Telegramer-2.1.1.3-py${{ matrix.python-version }}.egg'
# asset_content_type: application/octet-stream
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2.7.18-alpine3.11 AS base
FROM python:3.10-alpine3.15 AS base

RUN mkdir -p /usr/src/app
RUN mkdir -p /output
Expand Down
14 changes: 14 additions & 0 deletions Dockerfile-py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
ARG PYTHON_VERSION=3.11
FROM python:${PYTHON_VERSION}-alpine AS base

RUN mkdir -p /usr/src/app
RUN mkdir -p /output
WORKDIR /usr/src/app

RUN pip install --no-cache-dir setuptools

COPY telegramer /usr/src/app/telegramer
COPY setup.py /usr/src/app/setup.py
COPY LICENSE /usr/src/app/LICENSE

RUN python setup.py bdist_egg
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p align="center"><a href="https://github.com/noam09/deluge-telegramer" title="Telegramer"><img src="https://i.imgur.com/xXIPX44.png" alt="Telegramer"></a></p>

![GitHub All Releases](https://img.shields.io/github/downloads/noam09/deluge-telegramer/total?style=flat-square) ![Deluge Version](https://img.shields.io/badge/deluge-1.3.15-blue?style=flat-square&logo=deluge)
![GitHub All Releases](https://img.shields.io/github/downloads/noam09/deluge-telegramer/total?style=flat-square) [![Deluge Version](https://img.shields.io/badge/deluge-1.3.15-blue?style=flat-square&logo=deluge)](https://github.com/noam09/deluge-telegramer/releases/tag/v1.3.1) [![Deluge Version](https://img.shields.io/badge/deluge-2.1.1-yellowgreen?style=flat-square&logo=deluge)](https://github.com/noam09/deluge-telegramer/releases/tag/2.1.1.0)

[Telegramer](https://github.com/noam09/deluge-telegramer) is a [Deluge](https://deluge-torrent.org) plugin for sending notifications, adding and viewing torrents using [Telegram](https://telegram.org/) messenger. It features both a GTK and Web UI.

Expand All @@ -20,7 +20,7 @@ Since the bot runs locally and is owned by the same user running it, Telegramer

## Requirements

Currently Telegramer has been tested mainly on Linux using Deluge 1.3.15. Support for Windows is also available.
Currently Telegramer has been tested mainly on Linux using Deluge 1.3.15. Support for Windows is also available. A [**beta** version](https://github.com/noam09/deluge-telegramer/releases/tag/2.1.1.0) of the plugin is available for Deluge 2, tested on v2.1.1.
Make sure you have Python [`setuptools`](https://pypi.python.org/pypi/setuptools#installation-instructions) installed in order to build the plugin.
The plugin itself works with the [`python-telegram-bot`](https://github.com/python-telegram-bot/python-telegram-bot) wrapper, which comes pre-packaged.

Expand Down
8 changes: 8 additions & 0 deletions build-all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash

docker build -f Dockerfile-py --build-arg PYTHON_VERSION=${PYTHON_VERSION} --no-cache -t telegramer.build . \
&& docker run -v $(pwd)/out:/tmp/out --rm -i telegramer.build sh -s << COMMANDS
python setup.py bdist_egg
chown -R $(id -u):$(id -g) dist
cp -ar dist/ /tmp/out/
COMMANDS
24 changes: 13 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@
#

from setuptools import setup, find_packages

__plugin_name__ = "Telegramer"
__author__ = "Noam"
__author_email__ = "[email protected]"
__version__ = "1.3.1"
__version__ = "2.1.1.3"
__url__ = "https://github.com/noam09"
__license__ = "GPLv3"
__description__ = "Control Deluge using Telegram"
Expand All @@ -68,14 +69,15 @@
long_description=__long_description__ if __long_description__ else __description__,
packages=packages,
package_data=__pkg_data__,
entry_points="""
[deluge.plugin.core]
%s = %s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
[deluge.plugin.web]
%s = %s:WebUIPlugin
[telegramer.libpaths]
include = telegramer.include
""" % ((__plugin_name__, __plugin_name__.lower())*3)
entry_points="""[deluge.plugin.core]
%s = %s:CorePlugin
[deluge.plugin.gtkui]
%s = %s:GtkUIPlugin
[deluge.plugin.web]
%s = %s:WebUIPlugin
[deluge.plugin.gtk3ui]
%s = %s:Gtk3UIPlugin
[telegramer.libpaths]
include = telegramer.include
""" % ((__plugin_name__, __plugin_name__.lower())*4)
)
21 changes: 16 additions & 5 deletions telegramer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,29 +54,40 @@ def load_libs():
for name in egg.get_entry_map("telegramer.libpaths"):
ep = egg.get_entry_info("telegramer.libpaths", name)
location = "%s/%s" % (egg.location, ep.module_name.replace(".", "/"))
sys.path.append(location)
log.error("Appending to sys.path: '%s'" % location)
if location not in sys.path:
sys.path.append(location)
log.error("NOTANERROR: Appending to sys.path: '%s'" % location)


class CorePlugin(PluginInitBase):
def __init__(self, plugin_name):
load_libs()
from core import Core as _plugin_cls
from .core import Core as _plugin_cls
self._plugin_cls = _plugin_cls
super(CorePlugin, self).__init__(plugin_name)


class GtkUIPlugin(PluginInitBase):
def __init__(self, plugin_name):
load_libs()
from gtkui import GtkUI as _plugin_cls
from .gtkui import GtkUI as _plugin_cls
self._plugin_cls = _plugin_cls
super(GtkUIPlugin, self).__init__(plugin_name)


class WebUIPlugin(PluginInitBase):
def __init__(self, plugin_name):
load_libs()
from webui import WebUI as _plugin_cls
from .webui import WebUI as _plugin_cls
self._plugin_cls = _plugin_cls
super(WebUIPlugin, self).__init__(plugin_name)


class Gtk3UIPlugin(PluginInitBase):
def __init__(self, plugin_name):
load_libs()
from .gtk3ui import Gtk3UI as GtkUIPluginClass
self._plugin_cls = GtkUIPluginClass
super(Gtk3UIPlugin, self).__init__(plugin_name)


Loading
Loading