mirror of
https://github.com/KokaKiwi/BarInsta
synced 2024-11-22 22:57:29 +00:00
download file name improvement
This commit is contained in:
parent
a0f608442a
commit
99e1cbef93
@ -147,7 +147,7 @@ public final class PostFetcher extends AsyncTask<Void, Void, FeedModel> {
|
|||||||
: MediaItemType.MEDIA_TYPE_IMAGE)
|
: MediaItemType.MEDIA_TYPE_IMAGE)
|
||||||
.setDisplayUrl(isChildVideo ? childNode.getString("video_url")
|
.setDisplayUrl(isChildVideo ? childNode.getString("video_url")
|
||||||
: childNode.getString("display_url"))
|
: childNode.getString("display_url"))
|
||||||
// .setShortCode(childNode.getString(Constants.EXTRAS_SHORTCODE))
|
.setShortCode(media.getString(Constants.EXTRAS_SHORTCODE))
|
||||||
.setVideoViews(isChildVideo && childNode.has("video_view_count")
|
.setVideoViews(isChildVideo && childNode.has("video_view_count")
|
||||||
? childNode.getLong("video_view_count")
|
? childNode.getLong("video_view_count")
|
||||||
: -1)
|
: -1)
|
||||||
|
@ -5,20 +5,19 @@ import java.io.Serializable;
|
|||||||
import awais.instagrabber.models.enums.MediaItemType;
|
import awais.instagrabber.models.enums.MediaItemType;
|
||||||
|
|
||||||
public final class PostChild implements Serializable {
|
public final class PostChild implements Serializable {
|
||||||
private String postId;
|
private final String postId;
|
||||||
private MediaItemType itemType;
|
private final String displayUrl;
|
||||||
private String displayUrl;
|
private final String shortCode;
|
||||||
|
private final MediaItemType itemType;
|
||||||
private final String thumbnailUrl;
|
private final String thumbnailUrl;
|
||||||
private final long videoViews;
|
private final long videoViews;
|
||||||
private int width;
|
private final int width;
|
||||||
private int height;
|
private final int height;
|
||||||
|
|
||||||
public static class Builder {
|
public static class Builder {
|
||||||
private String postId;
|
private String postId, displayUrl, shortCode, thumbnailUrl;
|
||||||
private MediaItemType itemType;
|
private MediaItemType itemType;
|
||||||
private String displayUrl;
|
|
||||||
private long videoViews;
|
private long videoViews;
|
||||||
private String thumbnailUrl;
|
|
||||||
private int width;
|
private int width;
|
||||||
private int height;
|
private int height;
|
||||||
|
|
||||||
@ -27,6 +26,11 @@ public final class PostChild implements Serializable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Builder setShortCode(final String shortCode) {
|
||||||
|
this.shortCode = shortCode;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
public Builder setItemType(final MediaItemType itemType) {
|
public Builder setItemType(final MediaItemType itemType) {
|
||||||
this.itemType = itemType;
|
this.itemType = itemType;
|
||||||
return this;
|
return this;
|
||||||
@ -58,11 +62,12 @@ public final class PostChild implements Serializable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public PostChild build() {
|
public PostChild build() {
|
||||||
return new PostChild(postId, itemType, displayUrl, thumbnailUrl, videoViews, height, width);
|
return new PostChild(postId, shortCode, itemType, displayUrl, thumbnailUrl, videoViews, height, width);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public PostChild(final String postId,
|
public PostChild(final String postId,
|
||||||
|
final String shortCode,
|
||||||
final MediaItemType itemType,
|
final MediaItemType itemType,
|
||||||
final String displayUrl,
|
final String displayUrl,
|
||||||
final String thumbnailUrl,
|
final String thumbnailUrl,
|
||||||
@ -70,6 +75,7 @@ public final class PostChild implements Serializable {
|
|||||||
final int height,
|
final int height,
|
||||||
final int width) {
|
final int width) {
|
||||||
this.postId = postId;
|
this.postId = postId;
|
||||||
|
this.shortCode = shortCode;
|
||||||
this.itemType = itemType;
|
this.itemType = itemType;
|
||||||
this.displayUrl = displayUrl;
|
this.displayUrl = displayUrl;
|
||||||
this.thumbnailUrl = thumbnailUrl;
|
this.thumbnailUrl = thumbnailUrl;
|
||||||
@ -82,6 +88,10 @@ public final class PostChild implements Serializable {
|
|||||||
return postId;
|
return postId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getShortCode() {
|
||||||
|
return shortCode;
|
||||||
|
}
|
||||||
|
|
||||||
public MediaItemType getItemType() {
|
public MediaItemType getItemType() {
|
||||||
return itemType;
|
return itemType;
|
||||||
}
|
}
|
||||||
@ -110,6 +120,7 @@ public final class PostChild implements Serializable {
|
|||||||
public String toString() {
|
public String toString() {
|
||||||
return "PostChild{" +
|
return "PostChild{" +
|
||||||
"postId='" + postId + '\'' +
|
"postId='" + postId + '\'' +
|
||||||
|
", shortCode=" + shortCode +
|
||||||
", itemType=" + itemType +
|
", itemType=" + itemType +
|
||||||
", displayUrl='" + displayUrl + '\'' +
|
", displayUrl='" + displayUrl + '\'' +
|
||||||
", thumbnailUrl='" + thumbnailUrl + '\'' +
|
", thumbnailUrl='" + thumbnailUrl + '\'' +
|
||||||
|
@ -88,11 +88,9 @@ public final class DownloadUtils {
|
|||||||
switch (method) {
|
switch (method) {
|
||||||
case DOWNLOAD_SAVED:
|
case DOWNLOAD_SAVED:
|
||||||
case DOWNLOAD_MAIN:
|
case DOWNLOAD_MAIN:
|
||||||
|
case DOWNLOAD_DISCOVER:
|
||||||
checkEachPost = true;
|
checkEachPost = true;
|
||||||
break;
|
break;
|
||||||
case DOWNLOAD_FEED:
|
|
||||||
checkEachPost = false;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
final int itemsToDownloadSize = itemsToDownload.size();
|
final int itemsToDownloadSize = itemsToDownload.size();
|
||||||
for (int i = 0; i < itemsToDownloadSize; i++) {
|
for (int i = 0; i < itemsToDownloadSize; i++) {
|
||||||
@ -100,7 +98,7 @@ public final class DownloadUtils {
|
|||||||
if (!checkEachPost) {
|
if (!checkEachPost) {
|
||||||
final boolean isSlider = itemsToDownloadSize > 1;
|
final boolean isSlider = itemsToDownloadSize > 1;
|
||||||
final File saveFile = getDownloadSaveFile(dir,
|
final File saveFile = getDownloadSaveFile(dir,
|
||||||
selectedItem.getPostId(),
|
selectedItem.getShortCode(),
|
||||||
isSlider ? "_slide_" + (i + 1) : "",
|
isSlider ? "_slide_" + (i + 1) : "",
|
||||||
selectedItem.getDisplayUrl()
|
selectedItem.getDisplayUrl()
|
||||||
);
|
);
|
||||||
@ -119,7 +117,7 @@ public final class DownloadUtils {
|
|||||||
final PostChild model = result.getSliderItems().get(j);
|
final PostChild model = result.getSliderItems().get(j);
|
||||||
final File saveFile = getDownloadSaveFile(
|
final File saveFile = getDownloadSaveFile(
|
||||||
finalDir,
|
finalDir,
|
||||||
model.getPostId(),
|
model.getShortCode(),
|
||||||
"_slide_" + (j + 1),
|
"_slide_" + (j + 1),
|
||||||
model.getDisplayUrl()
|
model.getDisplayUrl()
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user