diff --git a/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java b/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java index d9265fe..c9877c5 100644 --- a/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java +++ b/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/AbstractMediaFileManager.java @@ -54,6 +54,7 @@ public abstract class AbstractMediaFileManager { public abstract String getExtension(); public boolean isEmpty() { return isEmpty; } public boolean isDownloaded() { return new File(getTargetPathAndFilename()).isFile(); } + public boolean isDownloading() { return new File(getTargetPathAndFilename() + ".downloading").isFile(); } public abstract void download() throws RpcErrorException, IOException; public static void throwUnexpectedObjectError(Object o) { throw new RuntimeException("Unexpected " + o.getClass().getName()); diff --git a/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/StickerFileManager.java b/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/StickerFileManager.java index 10e16ba..48d7219 100644 --- a/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/StickerFileManager.java +++ b/src/main/java/de/fabianonline/telegram_backup/mediafilemanager/StickerFileManager.java @@ -47,19 +47,10 @@ public class StickerFileManager extends DocumentFileManager { public StickerFileManager(TLMessage msg, UserManager user, TelegramClient client) { super(msg, user, client); } - /* TLAbsDocument d = ((TLMessageMediaDocument)msg.getMedia()).getDocument(); - if (d instanceof TLDocument) { - this.doc = (TLDocument)d; - } else if (d instanceof TLDocumentEmpty) { - this.isEmpty = true; - } else { - throwUnexpectedObjectError(d); - } - }*/ public boolean isSticker() { return true; } - public String getTargetFilename() { + private String getFilenameBase() { TLDocumentAttributeSticker sticker = null; for(TLAbsDocumentAttribute attr : doc.getAttributes()) { if (attr instanceof TLDocumentAttributeSticker) { @@ -75,11 +66,13 @@ public class StickerFileManager extends DocumentFileManager { } file.append("_"); file.append(sticker.getAlt().hashCode()); - file.append("."); - file.append(getExtension()); return file.toString(); } + public String getTargetFilename() { + return getFilenameBase() + "." + getExtension(); + } + public String getTargetPath() { String path = Config.FILE_BASE + File.separatorChar + Config.FILE_STICKER_BASE + File.separatorChar; new File(path).mkdirs();