private void displayShareInfo(final Share share) {
    List<Integer> headers = new ArrayList<>();
    List<String> details = new ArrayList<>();

    headers.add(R.string.details_title);
    details.add(share.getName());

    headers.add(R.string.details_owner);
    details.add(share.getUsername());

    headers.add(R.string.details_description);
    details.add(share.getDescription());

    headers.add(R.string.details_url);
    details.add(share.getUrl());

    headers.add(R.string.details_created);
    details.add(Util.formatDate(share.getCreated()));

    headers.add(R.string.details_last_played);
    details.add(Util.formatDate(share.getLastVisited()));

    headers.add(R.string.details_expiration);
    details.add(Util.formatDate(share.getExpires(), false));

    headers.add(R.string.details_played_count);
    details.add(Long.toString(share.getVisitCount()));

    Util.showDetailsDialog(context, R.string.details_title_playlist, headers, details);
  }
  @Override
  public void onExecuteSync(Context context, int instance) throws NetworkNotValidException {
    try {
      ArrayList<String> syncedList = SyncUtil.getSyncedMostRecent(context, instance);
      MusicDirectory albumList =
          musicService.getAlbumList("newest", 20, 0, tagBrowsing, context, null);
      List<String> updated = new ArrayList<String>();
      boolean firstRun = false;
      if (syncedList.size() == 0) {
        // Get the initial set of albums on first run, don't sync any of these!
        for (MusicDirectory.Entry album : albumList.getChildren()) {
          syncedList.add(album.getId());
        }
        firstRun = true;
      } else {
        for (MusicDirectory.Entry album : albumList.getChildren()) {
          if (!syncedList.contains(album.getId())) {
            if (!"Podcast".equals(album.getGenre())) {
              try {
                if (downloadRecursively(null, getMusicDirectory(album), context, false)) {
                  updated.add(album.getTitle());
                }
              } catch (Exception e) {
                Log.w(
                    TAG,
                    "Failed to get songs for "
                        + album.getId()
                        + " on "
                        + Util.getServerName(context, instance));
              }
            }
            syncedList.add(album.getId());
          }
        }
      }

      if (updated.size() > 0) {
        while (syncedList.size() > 40) {
          syncedList.remove(0);
        }

        FileUtil.serialize(context, syncedList, SyncUtil.getMostRecentSyncFile(context, instance));

        // If there is a new album on the active server, chances are artists need to be refreshed
        if (Util.getActiveServer(context) == instance) {
          musicService.getIndexes(Util.getSelectedMusicFolderId(context), true, context, null);
        }

        Notifications.showSyncNotification(
            context, R.string.sync_new_albums, SyncUtil.joinNames(updated));
      } else if (firstRun) {
        FileUtil.serialize(context, syncedList, SyncUtil.getMostRecentSyncFile(context, instance));
      }
    } catch (Exception e) {
      Log.e(TAG, "Failed to get most recent list for " + Util.getServerName(context, instance));
    }
  }
  private void deleteShare(final Share share) {
    Util.confirmDialog(
        context,
        R.string.common_delete,
        share.getName(),
        new DialogInterface.OnClickListener() {
          @Override
          public void onClick(DialogInterface dialog, int which) {
            new LoadingTask<Void>(context, false) {
              @Override
              protected Void doInBackground() throws Throwable {
                MusicService musicService = MusicServiceFactory.getMusicService(context);
                musicService.deleteShare(share.getId(), context, null);
                return null;
              }

              @Override
              protected void done(Void result) {
                adapter.removeItem(share);
                Util.toast(
                    context,
                    context.getResources().getString(R.string.share_deleted, share.getName()));
              }

              @Override
              protected void error(Throwable error) {
                String msg;
                if (error instanceof OfflineException || error instanceof ServerTooOldException) {
                  msg = getErrorMessage(error);
                } else {
                  msg =
                      context
                              .getResources()
                              .getString(R.string.share_deleted_error, share.getName())
                          + " "
                          + getErrorMessage(error);
                }

                Util.toast(context, msg, false);
              }
            }.execute();
          }
        });
  }